diff --git a/bikeshop_project/core/migrations/0008_auto_20160526_0059.py b/bikeshop_project/core/migrations/0008_auto_20160526_0059.py new file mode 100644 index 0000000..b980641 --- /dev/null +++ b/bikeshop_project/core/migrations/0008_auto_20160526_0059.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-26 00:59 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0007_auto_20160501_2253'), + ] + + operations = [ + migrations.RemoveField( + model_name='payment', + name='membership', + ), + migrations.AddField( + model_name='membership', + name='payment', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Payment'), + ), + ] diff --git a/bikeshop_project/core/models.py b/bikeshop_project/core/models.py index 8cd0d6a..c0f02c8 100644 --- a/bikeshop_project/core/models.py +++ b/bikeshop_project/core/models.py @@ -6,21 +6,18 @@ class Membership(models.Model): created_at = models.DateTimeField(auto_now_add=True) modified_at = models.DateTimeField(auto_now=True) renewed_at = models.DateTimeField(default=timezone.now) - member = models.OneToOneField( - 'registration.Member', - on_delete=models.CASCADE, - related_name='membership' - ) self_identification = models.CharField(max_length=255, null=True, blank=True) gender = models.CharField(max_length=255, null=True, blank=True) involvement = models.CharField(max_length=255, null=True, blank=True) + payment = models.ForeignKey( + 'Payment', + on_delete=models.CASCADE, + blank=False, + null=True + ) class Payment(models.Model): - membership = models.ForeignKey( - 'Membership', - on_delete=models.CASCADE, - ) payment_choices = ( ('CASH', 'cash'), ('CHEQUE', 'cheque'),