예제 #1
0
파일: models.py 프로젝트: boxed/curia
    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
예제 #2
0
파일: models.py 프로젝트: boxed/curia
 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
예제 #3
0
파일: models.py 프로젝트: boxed/curia
 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()
예제 #4
0
파일: models.py 프로젝트: boxed/curia
    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()
예제 #5
0
파일: models.py 프로젝트: boxed/curia
 def get_absolute_url(self):
     return get_content_object(self).get_absolute_url()
예제 #6
0
파일: models.py 프로젝트: boxed/curia
 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)