mirror of
https://github.com/jazzband/django-ddp.git
synced 2026-03-16 22:40:24 +00:00
Set blank=True on AleaIdField, allowing adding items without inventing IDs yourself.
This commit is contained in:
parent
dbcfa65116
commit
282fe36b7e
1 changed files with 7 additions and 0 deletions
|
|
@ -214,10 +214,17 @@ class AleaIdField(models.CharField):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Assume max_length of 17 to match Meteor implementation."""
|
||||
kwargs['blank'] = True
|
||||
kwargs.setdefault('verbose_name', 'Alea ID')
|
||||
kwargs.setdefault('max_length', 17)
|
||||
super(AleaIdField, self).__init__(*args, **kwargs)
|
||||
|
||||
def deconstruct(self):
|
||||
"""Return arguments to pass to __init__() to re-create this field."""
|
||||
name, path, args, kwargs = super(AleaIdField, self).deconstruct()
|
||||
del kwargs['blank']
|
||||
return name, path, args, kwargs
|
||||
|
||||
def get_seeded_value(self, instance):
|
||||
"""Generate a syncronised value."""
|
||||
# Django model._meta is public API -> pylint: disable=W0212
|
||||
|
|
|
|||
Loading…
Reference in a new issue