diff --git a/bikeshop_project/core/migrations/0010_membership_member.py b/bikeshop_project/core/migrations/0010_membership_member.py new file mode 100644 index 0000000..c956f08 --- /dev/null +++ b/bikeshop_project/core/migrations/0010_membership_member.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-31 02:31 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('core', '0009_remove_membership_member'), + ] + + operations = [ + migrations.AddField( + model_name='membership', + name='member', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='membership', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/bikeshop_project/core/models.py b/bikeshop_project/core/models.py index c0f02c8..13be195 100644 --- a/bikeshop_project/core/models.py +++ b/bikeshop_project/core/models.py @@ -15,6 +15,13 @@ class Membership(models.Model): blank=False, null=True ) + member = models.OneToOneField( + 'registration.Member', + on_delete=models.CASCADE, + related_name='membership', + blank=True, + null=True + ) class Payment(models.Model): diff --git a/bikeshop_project/registration/migrations/0006_remove_member_membership.py b/bikeshop_project/registration/migrations/0006_remove_member_membership.py new file mode 100644 index 0000000..f5d750d --- /dev/null +++ b/bikeshop_project/registration/migrations/0006_remove_member_membership.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-31 02:31 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('registration', '0005_member_membership'), + ] + + operations = [ + migrations.RemoveField( + model_name='member', + name='membership', + ), + ] diff --git a/bikeshop_project/registration/models.py b/bikeshop_project/registration/models.py index 8905f32..fb5ef45 100644 --- a/bikeshop_project/registration/models.py +++ b/bikeshop_project/registration/models.py @@ -59,13 +59,6 @@ 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()