def save(self, *args, **kwargs):
     """Assign the current users company."""
     # if self.pk is None and 'company' not in self:
     if self.pk is None:
         user = get_current_user()
         self.company = user.company
     super(OperationMethod, self).save(*args, **kwargs)
    def save(self, *args, **kwargs):
        "Assign the current users company."
        if self.pk is None:
            user = get_current_user()
            self.company = user.company

        super(WorkPeriod, self).save(*args, **kwargs)
Пример #3
0
 def save(self, commit=True):
     user = super(UserCreationForm, self).save(commit=False)
     user.email = user.email.lower()
     # Assign the current users company
     user.company = get_current_user().company
     # Save the provided password in hashed form
     user.set_password(self.cleaned_data["password1"])
     if commit:
         user.save()
     return user
Пример #4
0
 def save(self, *args, **kwargs):
     "Assign the current user as the creator."
     if self.pk is None:
         self.creator = get_current_user()
     super(Part, self).save(*args, **kwargs)