예제 #1
0
 def update_users(self, user, sender, instance, **kwargs):
     # We need to make sure the user is authenticated first (e.g. not a SimpleLazyObject)
     if user is None or user.is_authenticated():
         registry = FieldRegistry()
         if sender in registry:
             for field in registry.get_fields(sender):
                 setattr(instance, field.name, user)
예제 #2
0
 def update_users(self, user, sender, instance, **kwargs):
     # We need to make sure the user is authenticated first (e.g. not a SimpleLazyObject)
     if user is None or user.is_authenticated():
         registry = FieldRegistry()
         if sender in registry:
             for field in registry.get_fields(sender):
                 setattr(instance, field.name, user)
예제 #3
0
 def contribute_to_class(self, cls, name):
     super(CurrentUserField, self).contribute_to_class(cls, name)
     registry = FieldRegistry()
     registry.add_field(cls, self)
예제 #4
0
 def contribute_to_class(self, cls, name):
     super(CurrentUserField, self).contribute_to_class(cls, name)
     registry = FieldRegistry()
     registry.add_field(cls, self)
예제 #5
0
 def update_users(self, user, sender, instance, **kwargs):
     registry = FieldRegistry()
     if sender in registry:
         for field in registry.get_fields(sender):
             setattr(instance, field.name, user)