Ticket #3163: meta-option-create_db_table.diff

File meta-option-create_db_table.diff, 2.2 KB (added by wolfram.kriesing@…, 18 years ago)
  • django/core/management.py

     
    474474                print "Processing %s.%s model" % (app_name, model._meta.object_name)
    475475            if model._meta.db_table in table_list:
    476476                continue
     477            if model._meta.create_db_table==False:
     478                continue
    477479            sql, references = _get_sql_model_create(model, seen_models)
    478480            seen_models.add(model)
    479481            created_models.add(model)
  • django/db/models/options.py

     
    1313
    1414DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
    1515                 'unique_together', 'permissions', 'get_latest_by',
    16                  'order_with_respect_to', 'app_label')
     16                 'order_with_respect_to', 'app_label', 'create_db_table')
    1717
    1818class Options(object):
    1919    def __init__(self, meta):
     
    3333        self.has_auto_field = False
    3434        self.one_to_one_field = None
    3535        self.parents = []
     36        self.create_db_table = True
    3637
    3738    def contribute_to_class(self, cls, name):
    3839        cls._meta = self
  • docs/model-api.txt

     
    928928Here's a list of all possible ``Meta`` options. No options are required. Adding
    929929``class Meta`` to a model is completely optional.
    930930
     931``create_db_table``
     932-------------------
     933
     934If you don't want this model to be created as a table in your database (when
     935calling ``manage.py syncdb``), set this to ``False``.
     936
     937    create_db_table = False
     938
     939If this isn't given, Django will assume ``True`` and ``manage.py syncdb`` will
     940create this model as a table in your database.
     941
     942This is useful, when you are using DB views which you create via
     943raw SQL but still want to be able to use the view as a model from within your
     944application.
     945
    931946``db_table``
    932947------------
    933948
Back to Top