Changes between Version 6 and Version 7 of IrcFAQ

02/20/07 08:41:02 (9 years ago)



  • IrcFAQ

    v6 v7  
    3030== How do I extend a model? I want to subclass django.contrib.auth.models.User. ==
    32 Can't do that right now, sorry. More:
     32Not at the moment, but model subclassing is being worked on.
    3434== If I change my model, will {{{ syncdb}}} update my database table? ==
    36 No. Sorry. You will have to do this manually. If you are not bothered about losing data, just do an sqlreset. Otherwise do this: Before changing the model, do {{{ python sqlall yourapp > old.sql }}}, then change your model and do the same {{{ sqlall yourapp > new.sql }}} compare the two files and you will see the difference that you will need to script for this.
     36No, you'll need to manually change your database table. If you use ` sqlall` on your app to produce a SQL file before editing your models, you can run it again afterwards and use the difference between the two to see what you need to change in the database.
    3838== What should I use for development -- the built-in server, mod_python, FastCGI? ==
    4242== What's the difference between {{{null=True}}} and {{{blank=True}}} in models? ==
    44 {{{null=True}}} tells Django that the DB schema should allow the storage of nulls in that field. {{{blank=True}}} indicates that the field is optional (e.g. the admin will not complain if you leave it blank).
     44`null=True` means that the database will accept a `NULL` value for that field; `blank=True` means that Django's validation system won't complain about a missing value. If you use `blank=True` but ''not'' `null=True` you will need to have your code fill in a value before storage in the database -- specifying a default on a field, or putting something in the model's `save` method to generate a value are two good ways to handle this, and can be extremely useful when you want to calculate one field's value based on others.
    4646== I think Ajax is awesome! How do I do Ajax with Django? ==
Back to Top