DJANGO QUERYSET INTERMEDIATE EXAM LATEST UPDATE model - ANSWER Each one of these is a Python class that subclasses django.db.models.Model. Each attribute of one of these represents a datab ase field. id field - ANSWER This field is added automatically, but this behav ior can be overridden How to activate your models - ANSWER edit your settings file and chang e the INSTALLED_APPS setting to add the name of the module that contains your models.py. when to run syncdb - ANSWER When you add new apps to INSTALLED_APPS class attributes - ANSWER Fields are specified by these what the field class type determines - ANSWER (1) The database column type (e.g. INTEGER, VARCHAR); (2) The widget to use in Django's admin interface, if you care to use it (e.g. <input type="text">, <select>); (3) The minimal validation requirements, used in Django's admin and in automatically-generated forms. null - ANSWER If this option is True, Django will store empty values as NULL in the database. Default is False. blank - ANSWER If this option is True, the field is allowed to be blank. D efault is False. choices - ANSWER An iterable (e.g., a list or tuple) of 2-tuples to use as options for this field. If this is given, Django's admin will use a select box in stead of the standard text field and will limit options to those given. choices tuple - ANSWER The first element in this iterable is the value t hat will be stored in the database, the second element will be displayed by the admin interface, or in a ModelChoiceField. default - ANSWER The value given in the absence of a specified value for the field. This can be a value or a callable object. If callable it will be called every tim e a new object is created. help_text - ANSWER Extra text to be displayed under the field on the o bject's admin form to provide assistance to users. It's useful for documentation even if your object doesn't have an admin form. primary_key - ANSWER If True, this field is the primary key for the model. unique - ANSWER If True, the table does not permit duplicate values for this field. many- to-one relationship - ANSWER Defined by django.db.models.ForeignKey. You use it just like any other Field type: by including it as a class attri bute of your model. ForeignKey - ANSWER Defines a many- to-one relationship. ou use it just like any other Field type: by including it as a class attribute of your model. many- to-many relationship - ANSWER Defined by a ManyToManyField. You use it just like any other Field type: by including it as a class attribu te of your model. ManyToManyField - ANSWER Defines a many- to-many relationship. You use it just like any other Field type: by including it as a class attribute of y our model. through argument - ANSWER Specifies the model that will be used to govern the many- to-many relationship. You can then put extra fields on the intermediate model. The intermediate model is associated with the ManyToManyField usi ng this to point to the model that will act as an intermediary. restrictions on intermediate models - ANSWER (1) Your intermediate model must contain one - and only one - foreign key to the target model. (2) Your i ntermediate model must contain one - and only one - foreign key to the source mo del. (3) When defining a many- to-many relationship from a model to itself, using an intermediary model, you must use symmetrical=False. Many- to-many relationship to self - ANSWER In this case, an intermediate model can have multiple foreign keys to the source model. Here, two foreign keys to the same model are permitted, but they will be treated as the two (different) si des of the
Voordelen van het kopen van samenvattingen bij Stuvia op een rij:
Verzekerd van kwaliteit door reviews
Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!
Snel en makkelijk kopen
Je betaalt supersnel en eenmalig met iDeal, creditcard of Stuvia-tegoed voor de samenvatting. Zonder lidmaatschap.
Focus op de essentie
Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!
Veelgestelde vragen
Wat krijg ik als ik dit document koop?
Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.
Tevredenheidsgarantie: hoe werkt dat?
Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.
Van wie koop ik deze samenvatting?
Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper luzlinkuz. Stuvia faciliteert de betaling aan de verkoper.
Zit ik meteen vast aan een abonnement?
Nee, je koopt alleen deze samenvatting voor €11,29. Je zit daarna nergens aan vast.