diff --git a/bikeshop_project/core/migrations/0012_auto_20160531_0234.py b/bikeshop_project/core/migrations/0012_auto_20160531_0234.py new file mode 100644 index 0000000..d4343da --- /dev/null +++ b/bikeshop_project/core/migrations/0012_auto_20160531_0234.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-31 02:34 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0011_auto_20160531_0233'), + ] + + operations = [ + migrations.RemoveField( + model_name='membership', + name='payment', + ), + migrations.AddField( + model_name='payment', + name='membership', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='core.Membership'), + ), + ] diff --git a/bikeshop_project/core/models.py b/bikeshop_project/core/models.py index 61a91c3..33bf3a2 100644 --- a/bikeshop_project/core/models.py +++ b/bikeshop_project/core/models.py @@ -9,12 +9,6 @@ class Membership(models.Model): 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 - ) member = models.ForeignKey( 'registration.Member', on_delete=models.CASCADE, @@ -34,6 +28,13 @@ class Payment(models.Model): ) type = models.CharField(max_length=12, choices=payment_choices) created_at = models.DateTimeField(auto_now_add=True) + membership = models.ForeignKey( + 'Membership', + on_delete=models.CASCADE, + related_name='payments', + blank=False, + null=True + ) class Visit(models.Model):