|Reported by:||to.roma.from.djbug@…||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
class UserManager(models.Manager): def create_user(self, username, email, password=None): "Creates and saves a User with the given username, e-mail and password." now = datetime.datetime.now() user = self.model(None, username, '', '', email.strip().lower(), 'placeholder', False, True, False, now, now) if password: user.set_password(password) else: user.set_unusable_password() user.save() return user
This should support keyword arguments for first_name, last_name etc. That would make user-creating code cleaner and would avoid unnecessary database operations. The change is so obvious I’m not including a patch.
Are there any reasons not to add such a feature?
Change History (5)
comment:1 Changed 8 years ago by mtredinnick
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 8 years ago by mtredinnick
- Triage Stage changed from Unreviewed to Design decision needed