Skip to content

Commit

Permalink
ticket9: pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
andreysobol committed Mar 11, 2012
1 parent aa75af9 commit be9dde8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion testsobol/mainapp/templatetags/my_tags.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
from django.template import Library, Node, Variable
from django.core.urlresolvers import reverse


register = Library()


class EditAdmin(Node):

def __init__(self, edit):
self.edit = Variable(edit)

def render(self, context):
e = self.edit.resolve(context)
return u'<a href="%s">Edit</a>' % reverse('admin:%s_%s_change' % (e._meta.app_label, e._meta.module_name), args=(e.id,))
return u'<a href="%s">Edit</a>' %\
reverse('admin:%s_%s_change' %\
(e._meta.app_label, e._meta.module_name), args=(e.id,))


def ed(parser, token):
Expand Down
8 changes: 4 additions & 4 deletions testsobol/mainapp/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ def test(self):
class Tag(TestCase):

def test(self):
fixtures = ['initial_data.json']

page = self.client.post('/accounts/login/', {'username': 'admin', 'password': 'admin'})
page = self.client.post('/accounts/login/',
{'username': 'admin', 'password': 'admin'})

page = self.client.get('/')
self.assertTrue(page.content.find('<a href="/admin/auth/user/1/"') != -1 )
self.assertTrue(page.content.find(
'<a href="/admin/auth/user/1/"') != -1)


class NameUrlTest(TestCase):
Expand Down

0 comments on commit be9dde8

Please sign in to comment.