Browse Source

Create on-to-many relationship.

feature/python-error-tracking
Drew Larson 9 years ago
parent
commit
88c8ac29f2
  1. 22
      bikeshop_project/core/migrations/0011_auto_20160531_0233.py
  2. 4
      bikeshop_project/core/models.py

22
bikeshop_project/core/migrations/0011_auto_20160531_0233.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-31 02:33
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 = [
('core', '0010_membership_member'),
]
operations = [
migrations.AlterField(
model_name='membership',
name='member',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='memberships', to=settings.AUTH_USER_MODEL),
),
]

4
bikeshop_project/core/models.py

@ -15,10 +15,10 @@ class Membership(models.Model):
blank=False, blank=False,
null=True null=True
) )
member = models.OneToOneField( member = models.ForeignKey(
'registration.Member', 'registration.Member',
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name='membership', related_name='memberships',
blank=True, blank=True,
null=True null=True
) )

Loading…
Cancel
Save