Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Django: Core

You're reading from   Mastering Django: Core The Complete Guide to Django 1.8 LTS

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher
ISBN-13 9781787281141
Length 694 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nigel George Nigel George
Author Profile Icon Nigel George
Nigel George
Arrow right icon
View More author details
Toc

Table of Contents (33) Chapters Close

Mastering Django: Core
Credits
About the Author
www.PacktPub.com
Preface
1. Introduction to Django and Getting Started FREE CHAPTER 2. Views and URLconfs 3. Templates 4. Models 5. The Django Admin Site 6. Forms 7. Advanced Views and URLconfs 8. Advanced Templates 9. Advanced Models 10. Generic Views 11. User Authentication in Django 12. Testing in Django 13. Deploying Django 14. Generating Non-HTML Content 15. Django Sessions 16. Djangos Cache Framework 17. Django Middleware 18. Internationalization 19. Security in Django 20. More on Installing Django 21. Advanced Database Management Model Definition Reference Database API Reference Generic View Reference Settings Built-in Template Tags and Filters Request and Response Objects Developing Django with Visual Studio

Model metadata options


Table A.3 is a complete list of model meta options you can give your model in its internal class Meta. For more detail on each meta option as well as examples, see the Django documentation at https://docs.djangoproject.com/en/1.8/ref/models/options/.

Option

Notes

abstract

If abstract = True, this model will be an abstract base class.

app_label

If a model is defined outside of an application in INSTALLED_APPS, it must declare which app it belongs to.

db_table

The name of the database table to use for the model.

db_tablespace

The name of the database tablespace to use for this model. The default is the project's DEFAULT_TABLESPACE setting, if set. If the backend doesn't support tablespaces, this option is ignored.

default_related_name

The name that will be used by default for the relation from a related object back to this one. The default is <model_name>_set.

get_latest_by

The name of an orderable field in the model, typically a DateField, DateTimeField, or IntegerField.

managed

Defaults to True, meaning Django will create the appropriate database tables in migrate or as part of migrations and remove them as part of a flush management command.

order_with_respect_to

Marks this object as orderable with respect to the given field.

ordering

The default ordering for the object, for use when obtaining lists of objects.

permissions

Extra permissions to enter into the permissions table when creating this object.

default_permissions

Defaults to ('add', 'change', 'delete').

proxy

If proxy = True, a model which subclasses another model will be treated as a proxy model.

select_on_save

Determines if Django will use the pre-1.6 django.db.models.Model.save() algorithm.

unique_together

Sets of field names that, taken together, must be unique.

index_together

Sets of field names that, taken together, are indexed.

verbose_name

A human-readable name for the object, singular.

verbose_name_plural

The plural name for the object.

Table A.3: Model metadata options

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images