Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions formidable/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import python_2_unicode_compatible

from formidable import constants
from formidable.register import FieldSerializerRegister


@python_2_unicode_compatible
class Formidable(models.Model):

label = models.CharField(max_length=256)
Expand Down Expand Up @@ -58,6 +60,7 @@ def __str__(self):
return '{formidable.label}'.format(formidable=self)


@python_2_unicode_compatible
class Field(models.Model):

class Meta:
Expand Down Expand Up @@ -87,6 +90,7 @@ def __str__(self):
return '{field.label}'.format(field=self)


@python_2_unicode_compatible
class Default(models.Model):

value = models.CharField(max_length=256)
Expand All @@ -96,6 +100,7 @@ def __str__(self):
return '{default.value}'.format(default=self)


@python_2_unicode_compatible
class Item(models.Model):
field = models.ForeignKey(Field, related_name='items')
value = models.CharField(max_length=256)
Expand All @@ -107,6 +112,7 @@ def __str__(self):
return '{item.label}: {item.value}'.format(item=self)


@python_2_unicode_compatible
class Access(models.Model):

class Meta:
Expand All @@ -124,6 +130,7 @@ def __str__(self):
access=self)


@python_2_unicode_compatible
class Validation(models.Model):
field = models.ForeignKey(Field, related_name='validations')
value = models.CharField(max_length=256)
Expand All @@ -135,6 +142,7 @@ def __str__(self):
validation=self)


@python_2_unicode_compatible
class Preset(models.Model):
form = models.ForeignKey(Formidable, related_name='presets')
slug = models.CharField(max_length=128)
Expand All @@ -144,6 +152,7 @@ def __str__(self):
return '{preset.slug}'.format(preset=self)


@python_2_unicode_compatible
class PresetArg(models.Model):
preset = models.ForeignKey(Preset, related_name='arguments')
slug = models.CharField(max_length=128)
Expand Down