SHARE
TWEET

Untitled

a guest Jun 20th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Registration_form(forms.Form):
  2.     Applicant_Name = forms.CharField(label='Your name', max_length=100)
  3.     Applicant_age = forms.IntegerField(label ='Age of Applicant')
  4.     Applicant_email =forms.EmailField(max_length=50)
  5.     Applicant_phone = forms.CharField(max_length=10)
  6.      
  7. class Registration_View(FormView):
  8.     template_name = 'EVENTAPP/Application.html'
  9.     form_class = Registration_form
  10.     success_url = '/'
  11.  
  12.     def form_valid(self, form):
  13.  
  14.         Applicant_Name = form.cleaned_data['Applicant_Name'],
  15.         Applicant_age=form.cleaned_data['Applicant_age'],
  16.         Applicant_email=form.cleaned_data['Applicant_email']
  17.         Applicant_phone=form.cleaned_data['Applicant_phone']
  18.  
  19.        # do some operations if form data valid
  20.  
  21.         return super().form_valid(form)
  22.      
  23. class es_event(models.Model):
  24.  
  25.     ev_name = models.CharField(max_length=100,verbose_name="Event Name")
  26.     ev_date = models.DateField(auto_now=False, verbose_name="Date")
  27.     ev_description = models.TextField(null=True, verbose_name="Description")
  28.  
  29.     registrant_name = models.BooleanField(default=True )
  30.     registrant_age = models.BooleanField(default=False)
  31.     registrant_phone = models.BooleanField(default=False)
  32.     registrant_email = models.BooleanField(default=False)
  33.     registrant_institution = models.BooleanField(default=False)
  34.  
  35.     name = models.CharField(max_length=100,null=True)
  36.     reg_open = True
  37.     slug = models.SlugField(max_length=250)
  38.  
  39.  
  40.     def save(self, *args, **kwargs):
  41.         self.slug = slugify(self.ev_name)
  42.         return super(es_event, self).save(*args, **kwargs)    
  43.     def get_absolute_url(self):
  44.             return reverse('event_detail', kwargs={'id': self.id, 'slug': self.slug })
  45.      
  46. url(r'^events/register(?P<id>d+)(?:/(?P<slug>[wd-]+))?/$', views.Registration_View.as_view(), name='event_application')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top