Exemplo n.º 1
0
    def short_description(self):
        if self.content_type != None:
            result = self.content_type.model_class()._meta.verbose_name.lower(
            ) + ': '
        else:
            result = 'None: '
        if self.inverse:
            result += gettext('not ')
        try:
            if self.object_id:
                result += smart_unicode(get_content_object(self))
            else:
                if self.content_type:
                    result += gettext('all ') + smart_unicode(
                        self.content_type) + 's'
                else:
                    result += gettext('everything ')
        except AttributeError:
            pass

        #if result != '':
        #    result += smart_unicode(gettext(' for '))
        #if self.owner_user:
        #    result += smart_unicode(gettext('user'))+u' '+smart_unicode(self.owner_user)
        #elif self.owner_group:
        #    result += smart_unicode(gettext('group'))+u' '+smart_unicode(self.owner_group)
        #else:
        #    result += _('myself')

        return result
Exemplo n.º 2
0
 def short_description(self):
     if self.content_type != None:
         result = self.content_type.model_class()._meta.verbose_name.lower()+': '
     else:
         result = 'None: '
     if self.inverse:
         result += gettext('not ')
     try:
         if self.object_id:
             result += smart_unicode(get_content_object(self))
         else:
             if self.content_type:
                 result += gettext('all ')+smart_unicode(self.content_type)+'s'
             else:
                 result += gettext('everything ')                    
     except AttributeError:
         pass
     
     #if result != '':
     #    result += smart_unicode(gettext(' for '))
     #if self.owner_user:
     #    result += smart_unicode(gettext('user'))+u' '+smart_unicode(self.owner_user)
     #elif self.owner_group:
     #    result += smart_unicode(gettext('group'))+u' '+smart_unicode(self.owner_group)
     #else:
     #    result += _('myself')
     
     return result
Exemplo n.º 3
0
 def get_absolute_url(self):
     if self.object_id == None:
         if self.content_type == None:
             if self.owner_user == None:
                 return self.owner_group.get_absolute_url()
             else:
                 return self.owner_user.get_absolute_url()
         else:
             if self.owner_user == None:
                 return '/%ss/groups/%s/' % (self.content_type, self.owner_group.id)
             else:
                 return '/%ss/users/%s/' % (self.content_type, self.owner_user.id)
             
     else:
         return get_content_object(self).get_absolute_url()
Exemplo n.º 4
0
    def get_absolute_url(self):
        if self.object_id == None:
            if self.content_type == None:
                if self.owner_user == None:
                    return self.owner_group.get_absolute_url()
                else:
                    return self.owner_user.get_absolute_url()
            else:
                if self.owner_user == None:
                    return '/%ss/groups/%s/' % (self.content_type,
                                                self.owner_group.id)
                else:
                    return '/%ss/users/%s/' % (self.content_type,
                                               self.owner_user.id)

        else:
            return get_content_object(self).get_absolute_url()
Exemplo n.º 5
0
 def get_absolute_url(self):
     return get_content_object(self).get_absolute_url()
Exemplo n.º 6
0
 def __unicode__(self):
     if self.user is None:
         return u'%s %s: %s' % (get_content_object(self), self.object_id, self.last_viewed)
     else:
         return u'%s %s %s: %s' % (get_content_object(self), self.object_id, self.user, self.last_viewed)