All transactions are now atomic
This commit is contained in:
parent
860c7b50e5
commit
9b090a145c
15 changed files with 61 additions and 20 deletions
|
|
@ -8,6 +8,7 @@ from django import forms
|
|||
from django.conf import settings
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import transaction
|
||||
from django.forms import CheckboxSelectMultiple
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
|
@ -57,6 +58,7 @@ class ProfileForm(forms.ModelForm):
|
|||
self.fields['address'].widget.attrs.update({"placeholder": "4 avenue des Sciences, 91190 GIF-SUR-YVETTE"})
|
||||
self.fields['promotion'].widget.attrs.update({"max": timezone.now().year})
|
||||
|
||||
@transaction.atomic
|
||||
def save(self, commit=True):
|
||||
if not self.instance.section or (("department" in self.changed_data
|
||||
or "promotion" in self.changed_data) and "section" not in self.changed_data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue