user.is_active = False
if commit:
user.save()
- profile = UserProfile(user=user,
+ self.profile = UserProfile(user=user,
address=data['address'],
address_detail=data.get('address_detail'),
postal_code=data['postal_code'],
return user
+class UserUseYourLawForm(UserForm):
+
+ def save(self, commit=True):
+ super(UserSourceForm, self).__save__(*args, **kwargs)
+ self.profile.source = "UseYourLaw"
+
+
class CorrectorForm(ModelForm):
# profile
address = CharField(label=_('Address'), max_length=255)
--- /dev/null
+# Generated by Django 3.2.13 on 2023-03-16 16:19
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('teleforma', '0022_conference_notified_live'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='profile',
+ name='source',
+ field=models.CharField(blank=True, max_length=32, null=True, verbose_name='Source'),
+ ),
+ migrations.AlterField(
+ model_name='conference',
+ name='notified_live',
+ field=models.BooleanField(default=False, verbose_name='Notifié live'),
+ ),
+ ]
max_length=15, blank=True, null=True)
siret = models.CharField('Siret',
max_length=14, blank=True, null=True)
+ source = models.CharField('Source',
+ max_length=32, blank=True, null=True)
class Meta(MetaCore):
db_table = app_label + '_' + 'profiles'
ReceiptPDFViewDownload, RegistrationPDFView,
RegistrationPDFViewDownload, UserAddView,
UserCompleteView, UserLoginView, UsersExportView,
- UsersView, WriteView, update_training)
+ UsersView, WriteView, update_training,
+ UserAddUseYourLawView)
from .views.payment import (PaymentStartView, bank_auto, bank_cancel,
bank_fail, bank_success)
# (r'^accounts/register0/$', RegistrationView.as_view(), {'form_class':CustomRegistrationForm}),
url(r'^accounts/register/$', UserAddView.as_view(),
name="teleforma-register"),
+ url(r'^accounts/register/uyl/$', UserAddUseYourLawView.as_view(),
+ name="teleforma-register-uyl"),
url(r'^accounts/register/(?P<username>.*)/complete/$',
UserCompleteView.as_view(), name="teleforma-register-complete"),
url(r'^accounts/register/(?P<username>.*)/download/$',
from ..decorators import access_required
from ..forms import (CorrectorForm, NewsItemForm, UserForm, WriteForm,
- get_unique_username)
+ get_unique_username, UserUseYourLawForm)
from ..models.core import Course, CourseType, Document, NamePaginator, Period
from ..models.crfpa import (IEJ, Discount, NewsItem, Parameters, Payback,
Payment, Profile, Student, Training, months_choices, payment_choices)
def get_success_url(self):
return reverse_lazy('teleforma-register-complete', kwargs={'username':self.object.username})
+
+class UserAddUseYourLawView(UserAddView):
+
+ model = User
+ template_name = 'registration/registration_form.html'
+ form_class = UserUseYourLawForm
+
+
+
class UserCompleteView(TemplateView):
template_name = 'registration/registration_complete.html'