Browse Source

Move payment field to membership.

feature/python-error-tracking
Drew Larson 9 years ago
parent
commit
3890fe41a8
  1. 25
      bikeshop_project/core/migrations/0008_auto_20160526_0059.py
  2. 15
      bikeshop_project/core/models.py

25
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'),
),
]

15
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'),

Loading…
Cancel
Save