undo cascade changes

pull/373/head
Jonathan Mares 5 years ago
parent bc1d47efb5
commit bfcfccfc8d
  1. 19
      examples/starwars/models.py
  2. 18
      graphene_django/tests/models.py

@ -5,13 +5,7 @@ from django.db import models
class Character(models.Model):
name = models.CharField(max_length=50)
ship = models.ForeignKey(
'Ship',
blank=True,
null=True,
on_delete=models.SET_NULL,
related_name='characters'
)
ship = models.ForeignKey('Ship', blank=True, null=True, related_name='characters')
def __str__(self):
return self.name
@ -19,10 +13,7 @@ class Character(models.Model):
class Faction(models.Model):
name = models.CharField(max_length=50)
hero = models.ForeignKey(
Character,
on_delete=models.SET_NULL,
)
hero = models.ForeignKey(Character)
def __str__(self):
return self.name
@ -30,11 +21,7 @@ class Faction(models.Model):
class Ship(models.Model):
name = models.CharField(max_length=50)
faction = models.ForeignKey(
Faction,
on_delete=models.SET_NULL,
related_name='ships'
)
faction = models.ForeignKey(Faction, related_name='ships')
def __str__(self):
return self.name

@ -15,11 +15,7 @@ class Pet(models.Model):
class FilmDetails(models.Model):
location = models.CharField(max_length=30)
film = models.OneToOneField(
'Film',
on_delete=models.CASCADE,
related_name='details'
)
film = models.OneToOneField('Film', related_name='details')
class Film(models.Model):
@ -68,16 +64,8 @@ class CNNReporter(Reporter):
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateField()
reporter = models.ForeignKey(
Reporter,
on_delete=models.SET_NULL,
related_name='articles'
)
editor = models.ForeignKey(
Reporter,
on_delete=models.SET_NULL,
related_name='edited_articles_+'
)
reporter = models.ForeignKey(Reporter, related_name='articles')
editor = models.ForeignKey(Reporter, related_name='edited_articles_+')
lang = models.CharField(max_length=2, help_text='Language', choices=[
('es', 'Spanish'),
('en', 'English')

Loading…
Cancel
Save