- Author
baiju.m.mail AT gmail.com
- Version
0.3.2
Note
from nose.tools import assert_equals | |
class CookiesTest(object): | |
def test_create_and_access_a_cookie(self): | |
"should be able to create and access a cookie" | |
self.browser.cookies.add({'sha': 'zam'}) | |
assert_equals(self.browser.cookies['sha'], 'zam') |
baiju.m.mail AT gmail.com
0.3.2
Note
>>> from uuid import uuid4 | |
>>> uuid4() | |
UUID('410e51fd-f2fe-40ea-9a67-16f1f5f5a4a7') | |
>>> str(uuid4()) | |
'b3a1a5d3-d241-4c47-9281-b29808fd5716' | |
>>> |
#... | |
#user = User.objects.all()[0] | |
session = self.client.session | |
session['user'] = user | |
session.save() |
def test_response_should_be_ordered_by_date_desc(self): | |
''' | |
Response should be ordered by -date | |
''' | |
self.assertIn('-date', Response._meta.ordering) |
Error.objects.values('exception', 'url').annotate(Count('url')) |
#save do model sobrescrito sem *args e **kwargs | |
ack "def save(.*force_insert.*)" -i --python -l | |
#filefield | |
ack 'filefield' -i --python -l | |
#imagefield | |
ack 'imagefield' -i --python -l | |
#formularios que usam post |
>>> def teste(nome, idade): | |
... print nome, idade | |
... | |
>>> teste('andrews', 26) | |
andrews 26 | |
>>> teste(nome='andrews', idade=26) | |
andrews 26 | |
>>> lista = ['pacote', 200] | |
>>> teste(*lista) | |
pacote 200 |
TINYMCE_DEFAULT_CONFIG = { | |
'plugins': "imagelist,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,imagemanager", | |
'theme': "advanced", | |
'lang': 'pt-br', | |
'content_css' : "/media/_css/classes.css", | |
'theme_advanced_font_sizes': "10px,12px,13px,14px,16px,18px,20px", | |
'height': '400px', | |
'width': '720px', | |
'font_size_style_values': "10px,12px,13px,14px,16px,18px,20px", | |
'theme_advanced_toolbar_location': "top", |
from tinymce.widgets import TinyMCE | |
class PostAdminForm(ModelForm): | |
conteudo = forms.CharField(widget=TinyMCE()) | |
descricao = forms.CharField(widget=TinyMCE()) | |
class Meta: | |
model = Post |