From 4a01e29b9fcaf5b96ce33671ed75e5fe1443bf8e Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 10:26:23 -0600 Subject: [PATCH] Move membership to Member. --- .../0009_remove_membership_member.py | 19 ++++++++++++++++ .../migrations/0005_member_membership.py | 22 +++++++++++++++++++ bikeshop_project/registration/models.py | 7 ++++++ 3 files changed, 48 insertions(+) create mode 100644 bikeshop_project/core/migrations/0009_remove_membership_member.py create mode 100644 bikeshop_project/registration/migrations/0005_member_membership.py diff --git a/bikeshop_project/core/migrations/0009_remove_membership_member.py b/bikeshop_project/core/migrations/0009_remove_membership_member.py new file mode 100644 index 0000000..6a8d3ba --- /dev/null +++ b/bikeshop_project/core/migrations/0009_remove_membership_member.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-26 01:50 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0008_auto_20160526_0059'), + ] + + operations = [ + migrations.RemoveField( + model_name='membership', + name='member', + ), + ] diff --git a/bikeshop_project/registration/migrations/0005_member_membership.py b/bikeshop_project/registration/migrations/0005_member_membership.py new file mode 100644 index 0000000..d6c4c1c --- /dev/null +++ b/bikeshop_project/registration/migrations/0005_member_membership.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-26 01:50 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0009_remove_membership_member'), + ('registration', '0004_auto_20160410_1816'), + ] + + operations = [ + migrations.AddField( + model_name='member', + name='membership', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='member', to='core.Membership'), + ), + ] diff --git a/bikeshop_project/registration/models.py b/bikeshop_project/registration/models.py index fb5ef45..8905f32 100644 --- a/bikeshop_project/registration/models.py +++ b/bikeshop_project/registration/models.py @@ -59,6 +59,13 @@ class Member(AbstractBaseUser, PermissionsMixin): waiver = models.DateTimeField(null=True, blank=True) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) + membership = models.OneToOneField( + 'core.Membership', + on_delete=models.CASCADE, + related_name='member', + blank=True, + null=True + ) objects = CustomMemberManager()