mirror of
https://github.com/django/django.git
synced 2024-12-24 01:55:49 +00:00
6461583b6c
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
33 lines
858 B
Python
33 lines
858 B
Python
from django.db import models
|
|
|
|
|
|
class Foo(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
friend = models.CharField(max_length=50, blank=True)
|
|
|
|
|
|
class Bar(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
normal = models.ForeignKey(Foo, models.CASCADE, related_name='normal_foo')
|
|
fwd = models.ForeignKey("Whiz", models.CASCADE)
|
|
back = models.ForeignKey("Foo", models.CASCADE)
|
|
|
|
|
|
class Whiz(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
class Child(models.Model):
|
|
parent = models.OneToOneField('Base', models.CASCADE)
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
class Base(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
class Article(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
text = models.TextField()
|
|
submitted_from = models.GenericIPAddressField(blank=True, null=True)
|