django of inquiry

django the user (loginlogoutprofiles) module

Nothing to say, used to say, it is quite simple.

Table query api:

Table .objects.all () - Returns the list

Table .objects.all (). First (), returns the first

Table .objects.filter (id = 2) - [ obj1,], to obtain a list , a list only, keep first () large column   django the query g>, or [0] accessible to a particular subject

Table .objects.get (id = 2), to give a single object can be found is determined, may be used if found more, or not, are given .

Whether or returns a list, it is an object type, there are a number of fields, such as

User table, select the username 'xxx' = records, returns a list, and then get () Kazakhstan, returns an object . Object has a plurality of attributes such as username password email, etc.

hint1:

Once again from scratch to create app. First do not configure urls , when you makemigrates will put you declare but did not write the pit to find out. Like a good data structure, create models, tables and fields , and then migrate after the expiry.

Guess you like

Origin www.cnblogs.com/liuzhongrong/p/12000135.html