Ticket #12107: 12107.model_meta_serialize.1.diff

File 12107.model_meta_serialize.1.diff, 1.9 KB (added by emulbreh, 6 years ago)

with docs

  • django/db/models/options.py

     
    2121DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
    2222                 'unique_together', 'permissions', 'get_latest_by',
    2323                 'order_with_respect_to', 'app_label', 'db_tablespace',
    24                  'abstract', 'managed', 'proxy')
     24                 'abstract', 'managed', 'proxy', 'serialize')
    2525
    2626class Options(object):
    2727    def __init__(self, meta, app_label=None):
     
    4545        self.managed = True
    4646        self.proxy = False
    4747        self.proxy_for_model = None
     48        self.serialize = True
    4849        self.parents = SortedDict()
    4950        self.duplicate_targets = {}
    5051
  • django/core/management/commands/dumpdata.py

     
    7373                model_list = get_models(app)
    7474
    7575            for model in model_list:
    76                 if not model._meta.proxy:
     76                if not model._meta.proxy and model._meta.serialize:
    7777                    objects.extend(model._default_manager.all())
    7878
    7979        try:
  • docs/ref/models/options.txt

     
    200200If set to ``True``, a model which subclasses another model will be treated as
    201201a :ref:`proxy model <proxy-models>`.
    202202
     203``serialize``
     204-------------
     205
     206.. attribute:: Options.serialize
     207
     208.. versionadded:: 1.2
     209
     210If set to ``False``, the model will not be serialized by ``django-admin.py dumpdata``. Defaults to ``True``.
     211
    203212``unique_together``
    204213-------------------
    205214
Back to Top