Exemplo n.º 1
0
    def normalize_for_view(self, img_width):
        """Return attributes as a dictionary for use in a view context
        
        This allows using the same template across different models with
        differently-named attributes that hold similar information.

        """
        return {
            "type": _("News"),
            "title": self.title,
            "author": format_user_name(self.author),
            "date": self.created,
            "image_html": ' <img src="%s" />' % (self.image.url),
            "excerpt": self.body,
            "url": self.get_absolute_url(),
        }
Exemplo n.º 2
0
    def normalize_for_view(self, img_width):
        """Return attributes as a dictionary for use in a view context
        
        This allows using the same template across different models with
        differently-named attributes that hold similar information.

        """
        return {
            "type": _("News"),
            "title": self.title,
            "author": format_user_name(self.author),
            "date": self.created, 
            "image_html":' <img src="%s" />' % (self.image.url),
            "excerpt": self.body,
            "url": self.get_absolute_url(),
        }
Exemplo n.º 3
0
 def name(self):
     # Import needs to go here to prevent a circular import
     from storybase_user.utils import format_user_name
     return format_user_name(self.user)
Exemplo n.º 4
0
 def contributor_name(self):
     """
     Return the contributor's first name and last initial or username
     """ 
     return format_user_name(self.author) 
Exemplo n.º 5
0
 def contributor_name(self):
     """
     Return the contributor's first name and last initial or username
     """
     return format_user_name(self.author)
Exemplo n.º 6
0
def not_member(step, username, name):
    user = User.objects.get(username=username)
    world.browser.visit(django_url("/organizations/%s" % world.organization.organization_id))
    world.assert_text_not_present("Organization Contributors")
    world.assert_text_not_present(format_user_name(user))
Exemplo n.º 7
0
def not_member(step, username, name):
    user = User.objects.get(username=username)
    world.browser.visit(
        django_url('/organizations/%s' % world.organization.organization_id))
    world.assert_text_not_present("Organization Contributors")
    world.assert_text_not_present(format_user_name(user))