mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-28 12:33:43 +03:00
775d2e3523
* Update travis and tox * Use xenial distribution * Don't install coveralls twice * Add black and flake8 tox commands * Remove Python 3.5 test for Django master * Fix indent * Ignore migrations * Remove black for now * Run black formatting (#668) * Run black format * Update makefile * Add black to travis build
34 lines
752 B
Python
34 lines
752 B
Python
from __future__ import absolute_import
|
|
|
|
from django.db import models
|
|
|
|
|
|
class Character(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
ship = models.ForeignKey(
|
|
"Ship",
|
|
on_delete=models.CASCADE,
|
|
blank=True,
|
|
null=True,
|
|
related_name="characters",
|
|
)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class Faction(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
hero = models.ForeignKey(Character, on_delete=models.CASCADE)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class Ship(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
faction = models.ForeignKey(Faction, on_delete=models.CASCADE, related_name="ships")
|
|
|
|
def __str__(self):
|
|
return self.name
|