Move agreement to terms to a Category
- Remove field from attendee model - Create the category instead - Add a product as well
This commit is contained in:
		
							parent
							
								
									348e1c5c82
								
							
						
					
					
						commit
						e325454fab
					
				
					 4 changed files with 64 additions and 23 deletions
				
			
		|  | @ -28,5 +28,4 @@ class ProfileForm(forms.ModelForm): | |||
|         } | ||||
|         field_classes = { | ||||
|             "of_legal_age": YesNoField, | ||||
|             "agreement": YesNoField, | ||||
|         } | ||||
|  |  | |||
|  | @ -67,6 +67,20 @@ class Command(BaseCommand): | |||
|             limit_per_user=1, | ||||
|             order=1, | ||||
|         ) | ||||
|         self.terms = self.find_or_make( | ||||
|             inv.Category, | ||||
|             ("name",), | ||||
|             name="Terms, Conditions, and Code of Conduct Acceptance", | ||||
|             description="I agree to the " | ||||
|                         "<a href=\"https://linux.conf.au/attend/terms-and-conditions\"> " | ||||
|                         "terms and conditions of attendance</a>, and I have read, " | ||||
|                         "understood, and agree to act according to the standards set " | ||||
|                         "forth in our <a href=\"https://linux.conf.au/attend/code-of-conduct\">" | ||||
|                         "Code of Conduct</a>.", | ||||
|             required=True, | ||||
|             render_type=inv.Category.RENDER_TYPE_CHECKBOX, | ||||
|             order=10, | ||||
|         ) | ||||
|         self.penguin_dinner = self.find_or_make( | ||||
|             inv.Category, | ||||
|             ("name",), | ||||
|  | @ -78,7 +92,7 @@ class Command(BaseCommand): | |||
|             required=False, | ||||
|             render_type=inv.Category.RENDER_TYPE_QUANTITY, | ||||
|             limit_per_user=10, | ||||
|             order=10, | ||||
|             order=20, | ||||
|         ) | ||||
|         self.speakers_dinner_ticket = self.find_or_make( | ||||
|             inv.Category, | ||||
|  | @ -91,7 +105,7 @@ class Command(BaseCommand): | |||
|             required=False, | ||||
|             render_type=inv.Category.RENDER_TYPE_QUANTITY, | ||||
|             limit_per_user=5, | ||||
|             order=20, | ||||
|             order=30, | ||||
|         ) | ||||
|         self.pdns_category = self.find_or_make( | ||||
|             inv.Category, | ||||
|  | @ -105,7 +119,7 @@ class Command(BaseCommand): | |||
|             required=False, | ||||
|             render_type=inv.Category.RENDER_TYPE_RADIO, | ||||
|             limit_per_user=1, | ||||
|             order=30, | ||||
|             order=40, | ||||
|         ) | ||||
|         self.t_shirt = self.find_or_make( | ||||
|             inv.Category, | ||||
|  | @ -115,7 +129,7 @@ class Command(BaseCommand): | |||
|                         "linux.conf.au 2018 artwork.", | ||||
|             required=False, | ||||
|             render_type=inv.Category.RENDER_TYPE_ITEM_QUANTITY, | ||||
|             order=40, | ||||
|             order=50, | ||||
|         ) | ||||
|         # self.accommodation = self.find_or_make( | ||||
|         #     inv.Category, | ||||
|  | @ -258,6 +272,17 @@ class Command(BaseCommand): | |||
|             order=90, | ||||
|         ) | ||||
| 
 | ||||
|         # Agreements | ||||
|         self.accept_terms = self.find_or_make( | ||||
|             inv.Product, | ||||
|             ("name","category",), | ||||
|             category = self.terms, | ||||
|             name="I Accept", | ||||
|             price=Decimal("00.00"), | ||||
|             reservation_duration=hours(24), | ||||
|             order=10, | ||||
|             limit_per_user=1, | ||||
|         ) | ||||
|         # Penguin dinner | ||||
| 
 | ||||
|         self.penguin_adult = self.find_or_make( | ||||
|  | @ -637,7 +662,23 @@ class Command(BaseCommand): | |||
|             self.extras, | ||||
|             self.t_shirt, | ||||
|             self.penguin_dinner, | ||||
|             self.pdns_category, | ||||
|         ]) | ||||
|         # Require attendees to accept the T&Cs and Code of Conduct | ||||
|         needs_agreement = self.find_or_make( | ||||
|             cond.CategoryFlag, | ||||
|             ("description", ), | ||||
|             description="Must Accept Terms", | ||||
|             condition=cond.FlagBase.DISABLE_IF_FALSE, | ||||
|             enabling_category = self.terms, | ||||
|         ) | ||||
|         needs_agreement.categories.set([ | ||||
|             self.extras, | ||||
|             self.t_shirt, | ||||
|             self.penguin_dinner, | ||||
|             self.pdns_category, | ||||
|         ]) | ||||
| 
 | ||||
| 
 | ||||
|     def populate_discounts(self): | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,19 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.11.5 on 2017-10-01 08:14 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('pinaxcon_registrasion', '0007_auto_20170930_1610'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.RemoveField( | ||||
|             model_name='attendeeprofile', | ||||
|             name='agreement', | ||||
|         ), | ||||
|     ] | ||||
|  | @ -66,12 +66,6 @@ class AttendeeProfile(rego.AttendeeProfileBase): | |||
|                 "Please fill in line 1 before filling line 2", | ||||
|             )) | ||||
| 
 | ||||
|         if not self.agreement: | ||||
|             errors.append(( | ||||
|                 "agreement", | ||||
|                 "Agreement to the terms and conditions and to the Code of Conduct is required.", | ||||
|             )) | ||||
| 
 | ||||
|         if errors: | ||||
|             raise ValidationError(dict(errors)) | ||||
| 
 | ||||
|  | @ -201,18 +195,6 @@ class AttendeeProfile(rego.AttendeeProfileBase): | |||
|         blank=True, | ||||
|     ) | ||||
| 
 | ||||
|     agreement = models.BooleanField( | ||||
|         blank=False, | ||||
|         help_text="I agree to the " | ||||
|                   "<a href=\"https://linux.conf.au/attend/terms-and-conditions\"> " | ||||
|                   "terms and conditions of attendance</a>, and I have read, " | ||||
|                   "understood, and agree to act according to the standards set " | ||||
|                   "forth in our " | ||||
|                   "<a href=\"https://linux.conf.au/attend/code-of-conduct\">" | ||||
|                   "Code of Conduct</a>." | ||||
|     ) | ||||
| 
 | ||||
| 
 | ||||
|     past_lca = models.ManyToManyField( | ||||
|         PastEvent, | ||||
|         verbose_name="Which past linux.conf.au events have you attended?", | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley