forked from hagsteel/swampdragon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
44 lines (28 loc) · 1.11 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from swampdragon.models import SelfPublishModel
from django.db import models
from .serializers import FooSelfPubSerializer, BarSelfPubSerializer, BoolSelfPubSerializer
class SDModel(models.Model):
class Meta:
app_label = 'tests'
abstract = True
class TextModel(SDModel):
text = models.CharField(max_length=100)
class TwoFieldModel(SDModel):
text = models.CharField(max_length=50)
number = models.IntegerField()
class ParentModel(SDModel):
name = models.CharField(max_length=100)
class ChildModel(SDModel):
parent = models.ForeignKey(ParentModel)
number = models.IntegerField()
class FooSelfPub(SelfPublishModel, SDModel):
serializer_class = FooSelfPubSerializer
name = models.CharField(max_length=100)
number = models.IntegerField(null=True)
class BarSelfPub(SelfPublishModel, SDModel):
serializer_class = BarSelfPubSerializer
date = models.DateTimeField()
foo = models.ForeignKey(FooSelfPub, related_name='bars')
class BoolSelfPub(SelfPublishModel, SDModel):
serializer_class = BoolSelfPubSerializer
bool = models.BooleanField(default=False)