First method:

1. instantiating

p1=Card(name=’Hot Pot’, city=’San Diego’)

2. saving

p1.save()

Note here before calling save() method, it is not saved in the DB.

Django executes an SQL INSERT statement when save() is called.

Second method:

p1=Card.objects.create(name=’Hot Pot’, city=’San Diego’)

Use

objects.craete() method

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 Web Oom Suffusion theme by Sayontan Sinha
Switch to our mobile site
Top Footer