Esempio 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(),
        }
Esempio 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(),
        }
Esempio 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)
Esempio n. 4
0
 def contributor_name(self):
     """
     Return the contributor's first name and last initial or username
     """ 
     return format_user_name(self.author) 
Esempio n. 5
0
 def contributor_name(self):
     """
     Return the contributor's first name and last initial or username
     """
     return format_user_name(self.author)
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))
Esempio 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))