Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rhblind committed Jan 12, 2013
1 parent 8154625 commit e6aad92
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions files/templatetags/attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def lookup_content_type(token, tagname):
app, model = token.split(".")
return ContentType.objects.get_by_natural_key(app, model)
except ValueError:
raise template.TemplateSyntaxError("Third argument in %r must be in the formate 'app.model'" % tagname)
raise template.TemplateSyntaxError("Third argument in %r must be in the format 'app.model'" % tagname)
except ContentType.DoesNotExist:
raise template.TemplateSyntaxError("%r tag has non-existant content-type: '%s.%s'" % (tagname, app, model))

Expand All @@ -73,14 +73,14 @@ def __init__(self, ctype=None, object_pk_expr=None, object_expr=None, as_varname
self.attachment = attachment

def render(self, context):
qs = self.get_query_set(context)
qs = self.get_queryset(context)
context[self.as_varname] = self.get_context_value_from_queryset(context, qs)
return ""

def get_query_set(self, context):
def get_queryset(self, context):
ctype, object_pk = self.get_target_ctype_pk(context)
if not object_pk:
return self.attachment_model.objects.none()
return self.attachment_model.objects.none()

qs = self.attachment_model.objects.filter(
content_type=ctype,
Expand Down Expand Up @@ -283,7 +283,7 @@ def render(self, context):
"attachments/%s/list.html" % ctype.model,
"attachments/list.html"
]
qs = self.get_query_set(context)
qs = self.get_queryset(context)
context.push()
liststr = render_to_string(template_search_list, {
"attachment_list": self.get_context_value_from_queryset(context, qs)
Expand Down

0 comments on commit e6aad92

Please sign in to comment.