parent
							
								
									d1448c7041
								
							
						
					
					
						commit
						5ba01ee7d3
					
				|  | @ -33,7 +33,7 @@ TEST_RUNNER = 'django.test.runner.DiscoverRunner' | ||||||
| 
 | 
 | ||||||
| ########## CELERY | ########## CELERY | ||||||
| # In development, all tasks will be executed locally by blocking until the task returns | # In development, all tasks will be executed locally by blocking until the task returns | ||||||
| CELERY_ALWAYS_EAGER = True | CELERY_TASK_ALWAYS_EAGER = True | ||||||
| ########## END CELERY | ########## END CELERY | ||||||
| 
 | 
 | ||||||
| # Your local stuff: Below this line define 3rd party library settings | # Your local stuff: Below this line define 3rd party library settings | ||||||
|  |  | ||||||
|  | @ -1,22 +1,25 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| from django.db import models | from django.db import models | ||||||
| from django import forms | from django import forms | ||||||
| 
 |  | ||||||
| from .models import Blurb | from .models import Blurb | ||||||
| 
 | 
 | ||||||
| PAYMENT_PROVIDERS = ( | PAYMENT_PROVIDERS = ( | ||||||
|     ('gocardless', 'GoCardless'), |     ("gocardless", "GoCardless"), | ||||||
|     # ('braintree', 'Braintree'), |     # ('braintree', 'Braintree'), | ||||||
| ) | ) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| class BlurbForm(forms.ModelForm): | class BlurbForm(forms.ModelForm): | ||||||
|  | 
 | ||||||
|     class Meta: |     class Meta: | ||||||
|         model = Blurb |         model = Blurb | ||||||
|         exclude = ['user'] |         exclude = ["user"] | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class MembershipJoinForm(forms.Form): | class MembershipJoinForm(forms.Form): | ||||||
|     payment_provider = forms.ChoiceField( |     payment_provider = forms.ChoiceField( | ||||||
|         required=True, |         required=True, widget=forms.Select, choices=PAYMENT_PROVIDERS | ||||||
|         widget=forms.Select, |     ) | ||||||
|         choices=PAYMENT_PROVIDERS) |  | ||||||
| 
 | 
 | ||||||
|     amount = forms.DecimalField(required=True, decimal_places=2) |     amount = forms.DecimalField(required=True, decimal_places=2) | ||||||
|  |     over_18 = forms.BooleanField(required=True) | ||||||
|  |  | ||||||
|  | @ -0,0 +1,18 @@ | ||||||
|  | # Generated by Django 2.1.1 on 2018-10-08 13:02 | ||||||
|  | 
 | ||||||
|  | from django.db import migrations, models | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Migration(migrations.Migration): | ||||||
|  | 
 | ||||||
|  |     dependencies = [ | ||||||
|  |         ('users', '0009_auto_20180904_2035'), | ||||||
|  |     ] | ||||||
|  | 
 | ||||||
|  |     operations = [ | ||||||
|  |         migrations.AddField( | ||||||
|  |             model_name='membership', | ||||||
|  |             name='over_18', | ||||||
|  |             field=models.BooleanField(default=False, help_text='Please confirm your over 18'), | ||||||
|  |         ), | ||||||
|  |     ] | ||||||
|  | @ -25,6 +25,7 @@ class User(AbstractUser): | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     # https://github.com/pennersr/django-allauth/issues/520 |     # https://github.com/pennersr/django-allauth/issues/520 | ||||||
|  | 
 | ||||||
|     @property |     @property | ||||||
|     def image(self): |     def image(self): | ||||||
|         return self._image |         return self._image | ||||||
|  | @ -90,6 +91,9 @@ class Membership(models.Model): | ||||||
|         default=0, choices=MEMBERSHIP_STATUS_CHOICES |         default=0, choices=MEMBERSHIP_STATUS_CHOICES | ||||||
|     ) |     ) | ||||||
|     email = models.CharField(max_length=255, unique=True) |     email = models.CharField(max_length=255, unique=True) | ||||||
|  |     over_18 = models.BooleanField( | ||||||
|  |         default=False, help_text="Please confirm your over 18" | ||||||
|  |     ) | ||||||
| 
 | 
 | ||||||
|     @property |     @property | ||||||
|     def get_status(self): |     def get_status(self): | ||||||
|  | @ -98,11 +102,13 @@ class Membership(models.Model): | ||||||
|     def is_active(self): |     def is_active(self): | ||||||
|         if self.status is MEMBERSHIP_ACTIVE: |         if self.status is MEMBERSHIP_ACTIVE: | ||||||
|             return True |             return True | ||||||
|  | 
 | ||||||
|         return False |         return False | ||||||
| 
 | 
 | ||||||
|     def lookup_status(name): |     def lookup_status(name): | ||||||
|         if not name: |         if not name: | ||||||
|             return 0 |             return 0 | ||||||
|  | 
 | ||||||
|         return MEMBERSHIP_STATUS.get(name.lower(), 0) |         return MEMBERSHIP_STATUS.get(name.lower(), 0) | ||||||
| 
 | 
 | ||||||
|     def __str__(self): |     def __str__(self): | ||||||
|  | @ -110,6 +116,8 @@ class Membership(models.Model): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # users rfid card to user mapping, user can have more than one card | # users rfid card to user mapping, user can have more than one card | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| class Rfid(models.Model): | class Rfid(models.Model): | ||||||
|     code = models.CharField(max_length=7) |     code = models.CharField(max_length=7) | ||||||
|     description = models.CharField( |     description = models.CharField( | ||||||
|  | @ -132,11 +140,11 @@ class Rfid(models.Model): | ||||||
| 
 | 
 | ||||||
| def send_subscription_update_message(sender, instance, **kwargs): | def send_subscription_update_message(sender, instance, **kwargs): | ||||||
|     matrix_message.delay( |     matrix_message.delay( | ||||||
|         room='admin', |         room="admin", | ||||||
|         prefix=' - MEMBERSHIP', |         prefix=" - MEMBERSHIP", | ||||||
|         message='Changed to %s for user %s' % ( |         message="Changed to %s for user %s" | ||||||
|             instance.get_status, |         % (instance.get_status, instance.user.username), | ||||||
|             instance.user.username)) |     ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Needs to be change to seend to admin room, and not triger on scheduled job | # Needs to be change to seend to admin room, and not triger on scheduled job | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue