Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 3
0
 def contribute_to_class(self, cls, name):
     super(CurrentUserField, self).contribute_to_class(cls, name)
     registry = FieldRegistry()
     registry.add_field(cls, self)
Ejemplo n.º 4
0
 def contribute_to_class(self, cls, name):
     super(CurrentUserField, self).contribute_to_class(cls, name)
     registry = FieldRegistry()
     registry.add_field(cls, self)
Ejemplo n.º 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)