Monday, May 31, 2010

django problems

Hi Django,

I have few questions and would like to seek your help.


Q1) I have defined lot of admin actions and some of the actions
require creating threads. So I split my long models.py into set of
files. But whenever I try to import anything from models
python complains ?

ex: if i have defined model name

class Test(models.Model):
blah blah

In my second file, I tried importing this class by using following

from models import Test

from app_name.models import Test

but none of them work.I am not sure why ?

Q2) Also, I have split my admin functions into set of functions

func1(){

func2()

}


and in func2 (), if something bad happens

I would like to do self.message_user (request,"Bad") and then exit.

Right now i have to do return

But once it return back to func1() then it keeps on adding more of
those messages defined inside func1 ().

So how to do the redirect inside func2 () so that it simply exits and
displays just one message on admin.


Q3)Thirdly list_ordering dosent work for django default id. So i am
using django id (autoincrement primary key)

and would like to display in other way around like it should start
from 1 ---100 not from 100 ---1 on display.

so i tried this on admin model

lordering = ('-id',)

but it complains the id does not exist which exists though but not
defined by me.

Q4) how to change the theme for my django admin ?

Thanks for your help.

--RJ

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment