Reputation: 1795
How can I get current logged user profile in django, into models ?
I have this code:
def save(self, *args, **kwargs):
profile = User.get_profile()
self.empresa_id = profile.idempresa
self.empresa_id = profile.id_comerx3c
super(Cliente, self).save(*args, **kwargs)
but doesn`t work..
Upvotes: 0
Views: 276
Reputation: 34553
If you're using a ModelForm, you have three choices:
If you're just dealing with a Model, you have two choices:
Upvotes: 1