Django

Code

Ticket #3995: message_type.3.diff

File message_type.3.diff, 1.7 kB (added by joe4444, 3 years ago)

I think the others only worked for models.py from 0.96

  • /usr/lib/python2.3/site-packages/django_trunk/django/contrib/auth/models.py

    old new  
    230230    def get_and_delete_messages(self): 
    231231        messages = [] 
    232232        for m in self.message_set.all(): 
    233             messages.append(m.message
     233            messages.append(m
    234234            m.delete() 
    235235        return messages 
    236236 
     
    257257        return self._profile_cache 
    258258 
    259259class Message(models.Model): 
    260     """The message system is a lightweight way to queue messages for given users. A message is associated with a User instance (so it is only applicable for registered users). There's no concept of expiration or timestamps. Messages are created by the Django admin after successful actions. For example, "The poll Foo was created successfully." is a message. 
     260    """The message system is a lightweight way to queue messages for given users. A message is associated with a User instance (so it is only applicable for registered users). There's no concept of expiration or timestamps. Messages are created by the Django admin after successful actions. For example, "The poll Foo was created successfully." is a message. Now a message can be categorized as 'success' or 'failure' or 'generic' with success being the default. 
    261261    """ 
    262262    user = models.ForeignKey(User) 
    263263    message = models.TextField(_('message')) 
     264    category = models.CharField(maxlength=1, choices=(('S', 'success'), ('F', 'failure'), ('G', 'generic'),), default='S') 
    264265 
    265266    def __str__(self): 
    266267        return self.message