From 3890fe41a85578faa96142c8bc21a0a8e35d3063 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 10:25:54 -0600 Subject: [PATCH] Move payment field to membership. --- .../migrations/0008_auto_20160526_0059.py | 25 +++++++++++++++++++ bikeshop_project/core/models.py | 15 +++++------ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 bikeshop_project/core/migrations/0008_auto_20160526_0059.py 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'),