Initial value for a choices field in admin?

2007-08-21 Thread Amit Ramon
Hello, In one of my models I have a choices field: class MyModel(models.Model): units = models.CharField(maxlength=2, choices=UNITS) When I try to create a new instance of this model in the admin, the initial value in the select list for the units field is a dashed line. What I'd like is to b

localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
Hi I came across localflavors and would like to use the UKPostcodeField for post code validation. However when I try to import this I'm getting ViewDoesNotExist errors. Within my forms.py I'm importing like so: from django.contrib.localflavor.uk.forms import UKPostcodeField I'm then referencin

Foreign Key chaining in templates

2007-08-21 Thread Keith Mallory
I am trying to build a simple single page quiz model, with multiple questions with three classes for quiz,questions and answers, and fourth (not included) to manage the scores as given below. class Quiz(models.Model): name = models.CharField(maxlength=200) pub_date = models.DateTimeField()

Re: Foreign Key chaining in templates

2007-08-21 Thread Collin Grady
question.choice.all is wrong :) The default reverse relation name is FOO_set where FOO is the lower- case name of your model. So in your case, it would be question.choice_set.all --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Re: index page

2007-08-21 Thread Collin Grady
Make template tags for your various apps, and use them on the index page :) --~--~-~--~~~---~--~~ 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

Re: index page

2007-08-21 Thread MikeHowarth
It really depends on how complicated you want to make it. However using generic views would easily suffice, just set up a dictionary of the objects you need to pass in. Something like: django.views.generic.simple.direct_to_template would do the job. On Aug 21, 9:12 am, Rufman <[EMAIL PROTECTED]

Re: localflavor - UKPostcodeField

2007-08-21 Thread Collin Grady
You're importing UKPostcodeField - so why are you trying to use models.UKPostcodeField ? :) --~--~-~--~~~---~--~~ 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@goo

Re: localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
Sorry that was a typo on my part Colin Should have read: forms.UKPostcodeField() Think its time for a coffee! On Aug 21, 9:19 am, Collin Grady <[EMAIL PROTECTED]> wrote: > You're importing UKPostcodeField - so why are you trying to use > models.UKPostcodeField ? :) --~--~-~--~~-

Re: db-api optimization

2007-08-21 Thread Collin Grady
That probably isn't what you want, though it will work (technically speaking) The way you're doing it, that's going to chain the filters with AND, not OR, so only things that match the title and description for all words will show up. You probably want to build a Q object with | for an OR lookup

index page

2007-08-21 Thread Rufman
hi does anyone have a good idea how i could make an index page that combines different apps. e.g. the results of a poll is shown as well as a news feed next to it. thanks stephane rufer --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: localflavor - UKPostcodeField

2007-08-21 Thread Collin Grady
The same question applies though :) You didn't import the "forms" bit, you imported the field directly, so you should just be using it as UKPostcodeField :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django u

Re: Unicode question

2007-08-21 Thread Malcolm Tredinnick
On Mon, 2007-08-20 at 17:27 +, arthur debert wrote: > Hi Rob. > > After the unicode branch merge django expects and produces unicodes > objects throughout. > > A detail how to port guide is here: > http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist > > In

Re: Odd behavior of filtering

2007-08-21 Thread Malcolm Tredinnick
On Mon, 2007-08-20 at 22:04 +, Djon wrote: > Hi > > My model is: > > class Tag(models.Model): > name = models.CharField(maxlength=30) > > class Snippet(models.Model): > name = models.CharField(maxlength=30) > tags = > models.ManyToManyField(Tag,filter_interface=models.HORIZONTAL

Re: index page

2007-08-21 Thread Rufman
thanks...worked like a charm On Aug 21, 10:18 am, MikeHowarth <[EMAIL PROTECTED]> wrote: > It really depends on how complicated you want to make it. > > However using generic views would easily suffice, just set up a > dictionary of the objects you need to pass in. Something like: > django.views.

Re: index page

2007-08-21 Thread Rufman
thanks...worked like a charm On Aug 21, 10:18 am, MikeHowarth <[EMAIL PROTECTED]> wrote: > It really depends on how complicated you want to make it. > > However using generic views would easily suffice, just set up a > dictionary of the objects you need to pass in. Something like: > django.views.

Re: localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
So really I'd be better off using: from django.contrib.localflavor.uk import forms On Aug 21, 9:35 am, Collin Grady <[EMAIL PROTECTED]> wrote: > The same question applies though :) > > You didn't import the "forms" bit, you imported the field directly, so > you should just be using it as UKPostc

#4165: upload progress in safari

2007-08-21 Thread simonbun
Hello, Has anyone gotten the file upload progress bar from ticket #4165 to work in safari? It works great in IE and FF, but so far no luck on safari. For some reason the xmlhttp requests get stuck on readyState 1 when a file upload is in progress. When I run them without a file upload, the readyS

Re: index page

2007-08-21 Thread Rufman
do you by any chance know how the django admin page gets the help_text from the model...e.i. how can i get the help_text without having to define it again in my custom form? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: index page

2007-08-21 Thread Rufman
do you by any chance know how the django admin page gets the help_text from the model...e.i. how can i get the help_text without having to define it again in my custom form? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: db-api optimization

2007-08-21 Thread Grupo Django
Yes sorry, In this example I didn't realize about that, but in my code I have Q objects. I wrote it very quick. On 21 ago, 10:27, Collin Grady <[EMAIL PROTECTED]> wrote: > That probably isn't what you want, though it will work (technically > speaking) > > The way you're doing it, that's going to

Re: ugettext vs. ugettext_lazy

2007-08-21 Thread Malcolm Tredinnick
On Tue, 2007-08-21 at 00:09 +0200, Tomas Kopecek wrote: > Hello, > I've been playing with these functions and finally I've become totally > confused. > > I've expected that there would be some difference in behaviour, but I > was not able to create such use case in which these two functions >

Re: Database Fields

2007-08-21 Thread b3n
Thanks, Actually I was referring to the django admin tables as mentioned . I didn't define those models! None of these issues are a huge problem - but I'm a perfectionist ;) Ben, On Aug 17, 2:36 pm, Michal Ludvig <[EMAIL PROTECTED]> wrote: > b3n wrote: > > Thanks, > > > OK, but if a field va

Re: localflavor - UKPostcodeField

2007-08-21 Thread Malcolm Tredinnick
On Tue, 2007-08-21 at 02:20 -0700, MikeHowarth wrote: > So really I'd be better off using: > > from django.contrib.localflavor.uk import forms If, in the same file, you also do "import newforms as forms", things are going to go pear-shaped pretty quickly, so be careful. My gut reaction, if I'm

Re: localflavor - UKPostcodeField

2007-08-21 Thread MikeHowarth
Thats a very valid point Malcolm and something I'll implement! On Aug 21, 12:22 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-08-21 at 02:20 -0700, MikeHowarth wrote: > > So really I'd be better off using: > > > from django.contrib.localflavor.uk import forms > > If, in the sam

Re: ImageField via admin

2007-08-21 Thread Grigory Fateyev
Hello Carl Karsten! On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: > > settings.py:MEDIA_ROOT = BASE_DIR+'/media/' > > settings.py:MEDIA_URL = '/site_media/' > > urls.py:(r'^site_media/(?P.*)$', > > 'django.views.static.serve', {'document_root': > > settings.BASE_DIR+'/media/', 'show_indexes':

Re: FileField: changing file names

2007-08-21 Thread RajeshD
> dscn0001___.jpg > dscn0001.jpg > dscn0001_.jpg > > I could override the save() method to save the files under / > , but that would make the get_FOO_url and others fail. No it won't. As long as your ImageField ends up pointing to the correct relative path of your renamed imag

Re: quiz design

2007-08-21 Thread RajeshD
On Aug 19, 10:40 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote: > Hi, > > Has anyone worked on a quiz/ multiple choice contest design using Django > using Newforms? Yes. http://popteen.com/feature/view/style/looks/what-s-your-sunbathing-style-/ --~--~-~--~~~---~--~

Best practices for xmlrpc authentication

2007-08-21 Thread Kirk Strauser
We're using Django and SimpleXMLRPCDispatcher to publish some web service calls. The last missing piece is that I'm trying to put an authentication layer in front of the services and I'm not sure the best way to go about it. Right now I'm using Apache's mod_auth and AuthType Basic with an htp

Re: In-line Comments

2007-08-21 Thread RajeshD
> So the question is, if anybody is aware of an in-line comment system > we could use or build upon, otherwise I guess I'll try and do > something myself. A good starting point: http://www.jackslocum.com/blog/2006/10/09/my-wordpress-comments-system-built-with-yahoo-ui-and-yahooext/ --~--~

tutorial

2007-08-21 Thread wiboc
I'm starting django and doing the tutorial. Whet trying the admin pages, the foreign-key poll in the class choises shows not the reference but: -, poll object poll object why doesn't this works? --~--~-~--~~~---~--~~ You received this message because you

Template within a Template?

2007-08-21 Thread b3n
I want all of my "views" (HTML pages) to use a common header, footer etc. What is the python/django way of achieving this? I need to know because if I have to change the header/footer, then I only want to have to do it one place, rather than editing every template file. I can't get my head arou

Re: Template within a Template?

2007-08-21 Thread Kenneth Gonsalves
On 21-Aug-07, at 8:20 PM, b3n wrote: > What is the python/django way of achieving this? template inheritance -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: Template within a Template?

2007-08-21 Thread Dave Rowe
On Tue, 21 Aug 2007 20:27:20 +0530, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > On 21-Aug-07, at 8:20 PM, b3n wrote: > >> What is the python/django way of achieving this? > > template inheritance > Read this page. Read it all the way through. http://www.djangoproject.com/documentat

Re: Template within a Template?

2007-08-21 Thread b3n
Thanks :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For

Re: ImageField via admin

2007-08-21 Thread Carl Karsten
Grigory Fateyev wrote: > Hello Carl Karsten! > On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: > >>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/' >>> settings.py:MEDIA_URL = '/site_media/' >>> urls.py:(r'^site_media/(?P.*)$', >>> 'django.views.static.serve', {'document_root': >>> settings.BASE_D

Re: Template within a Template?

2007-08-21 Thread Tim Chase
> I want all of my "views" (HTML pages) to use a common header, footer > etc. > > What is the python/django way of achieving this? http://www.djangoproject.com/documentation/templates/#template-inheritance It's somewhat backwards from how other template-languages work that I've used, but it ma

Re: tutorial

2007-08-21 Thread Adam Fast
Check to make sure you're defining the __str__(self) on your poll object. That indicates that the object does not know how to turn itself into a string. (note that with trunk the best practice way to do this will be __unicode__ but with any of the static releases the new unicode method will not wo

Re: Odd 404 error on Textdrive with Lighty

2007-08-21 Thread David Merwin
For prosperities sake I will finish out what was causing the issue. RajeshD pointed out that the media url was being mapped directly to lighty. Which it was. So I moved all static media to a dir called 'static' and removed the line in the lighty vhost that maps media to lighty. Now it all works

Re: Template within a Template?

2007-08-21 Thread b3n
Actually I need another clue... I'm getting very confused about how to structure my Python projects/ apps. In settings.py: TEMPLATE_DIRS = ( "C:/Python/my_templates", ) In my template dir: mylinks/ mylinks/base_site.html mylinks/bookmark_list.html (extends base_site) Now in bookmark_list.

chinese django forum

2007-08-21 Thread [EMAIL PROTECTED]
hi,list I think there are many chinese django users,i think we can exchange info here http://forum.devshare.org. Make it the most popular django forum in china.Good luck all :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

How to make a mapping/alias db table? (many-to-many)

2007-08-21 Thread b3n
I've had 20 tabs open all day, all displaying django docs - but I can't work this out. A bookmark can have many categories, and a category can be in many bookmarks. So I just want a simple table that consists of category_id, bookmark_id >From the docs I thought Django would create this automatic

Re: ImageField via admin

2007-08-21 Thread Grigory Fateyev
Hello Carl Karsten! On Tue, 21 Aug 2007 10:21:06 -0500 you wrote: > > Grigory Fateyev wrote: > > Hello Carl Karsten! > > On Mon, 20 Aug 2007 14:07:39 -0500 you wrote: > > > >>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/' > >>> settings.py:MEDIA_URL = '/site_media/' > >>> urls.py:(r'^site_me

Re: Mod_Python and Apache

2007-08-21 Thread Sasha Weberov
On Aug 20, 6:38 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Aug 20, 5:13 pm, Sasha Weberov <[EMAIL PROTECTED]> wrote: > > > > > > > On Aug 20, 12:13 am, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > On Aug 20, 3:01 pm, Sasha Weberov <[EMAIL PROTECTED]> wrote: > > > > > Is it n

Re: In-line Comments

2007-08-21 Thread ToddG
Don't know if you're only looking for a django solution, but if you just need something that (AFAIK) works, this might do it: http://www.futureofthebook.org/commentpress/ thin layer over Wordpress to allow comments similar to djangobook, but in the sidebar instead of fancy little popup windows.

insert or update

2007-08-21 Thread Lic. José M. Rodriguez Bacallao
how can I know programatically if an operation in a model is an insert, update or delete? I just want to extend the admin log to log any action in my application models. Right now, admin app only log actions executed by itself. -- Lic. José M. Rodriguez Bacallao Cupet

Re: insert or update

2007-08-21 Thread George Vilches
Lic. José M. Rodriguez Bacallao wrote: > how can I know programatically if an operation in a model is an insert, > update or delete? > I just want to extend the admin log to log any action in my application > models. Right now, > admin app only log actions executed by itself. Part of your quest

Importing Excel/CVS into Database

2007-08-21 Thread robo
Hi, Have any of you guys imported excel/cvs by using Python/Django? I need to import 1000 products for a shopping site and I'd like to learn the fastest and easiest way to do so. Is there any free/shareware programs you guys would recommend? Thanks. --~--~-~--~~~--

Re: Importing Excel/CVS into Database

2007-08-21 Thread Kirk Strauser
On Tuesday 21 August 2007, robo wrote: > Have any of you guys imported excel/cvs by using Python/Django? Check out "pydoc csv". Python ships with a nice CSV-reader module. -- Kirk Strauser signature.asc Description: This is a digitally signed message part.

Problem using external CSS file with template

2007-08-21 Thread arelenas
I am trying to use external CSS in template using built-in Django web server but I'm experiencing some problems. I've set URLConf as described at http://www.djangoproject.com/documentation/0.96/static_files/, but still nothing. It finds CSS file but styles won't apply. When I try to use inline

Re: Problem using external CSS file with template

2007-08-21 Thread Will McCutchen
Hi, On Aug 21, 1:44 pm, arelenas <[EMAIL PROTECTED]> wrote: > I've set URLConf as described > athttp://www.djangoproject.com/documentation/0.96/static_files/, > but still nothing. It finds CSS file but styles won't apply. What does your URLConf look like? What is the URL you are using to link

Re: Importing Excel/CVS into Database

2007-08-21 Thread Tim Chase
> Have any of you guys imported excel/cvs by using > Python/Django? I need to import 1000 products for a shopping > site and I'd like to learn the fastest and easiest way to do > so. I do this day in and day out :) I prefer tab-delimited because it's easy and clean, though Python's built-in "cs

Re: ugettext vs. ugettext_lazy

2007-08-21 Thread Tomas Kopecek
Malcolm Tredinnick napsal(a): > makes 's1' a Unicode object. It's value will be based on the locale when > it is executed and then never change, no matter what the locale is. So > anything that is executed at *import* time should not be using > ugettext(). Since it's a cause of great confusion for

Re: Importing Excel/CVS into Database

2007-08-21 Thread olivier
> Have any of you guys imported excel/cvs by using Python/Django? I need > to import 1000 products for a shopping site and I'd like to learn the > fastest and easiest way to do so. If you need to load data straight from the Excel, you can use xlrd, which works great. http://www.lexicon.net/sjma

Re: insert or update

2007-08-21 Thread Peter Melvyn
On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote: > http://code.djangoproject.com/ticket/4879 > If you need that functionality, add a vote for it. :) Yes, I need such functionality :) Peter --~--~-~--~~~---~--~~ You received this message because you are subs

Re: insert or update

2007-08-21 Thread Lic. José M. Rodriguez Bacallao
how can I vote? On 8/21/07, Peter Melvyn <[EMAIL PROTECTED]> wrote: > > > On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote: > > > http://code.djangoproject.com/ticket/4879 > > If you need that functionality, add a vote for it. :) > > Yes, I need such functionality :) > > Peter > > > > -- Li

Re: insert or update

2007-08-21 Thread George Vilches
Lic. José M. Rodriguez Bacallao wrote: > how can I vote? There's no official voting mechanism for the non-Django developers right now, it's mostly just based on putting a comment on the Trac ticket or in the mailing list saying that you would use this functionality for such and such a reason.

Re: insert or update

2007-08-21 Thread Peter Melvyn
On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote: > or in the mailing list saying that you would use this > functionality for such and such a reason. OK, I'll specify the reason We use web as administrative/configuration tool for non-web based back-office server and we need to synchronize i

Re: Importing Excel/CVS into Database

2007-08-21 Thread Aidas Bendoraitis
Yes, I've done that. The following function read_excel_csv works with Excel CSV files saved on Mac (I can't remember exactly, but it might be that MS Office for Mac OS X saves CSV files using different separators than on Windows). The function reads the rows line by line, parses the cells of each

Re: Problem using external CSS file with template

2007-08-21 Thread arelenas
While I was writing reply to you Will, I've decided to try once more, just to make sure that I didn't make some stupid mistake, and surprisingly it worked! Only difference is that I've tried it on another computer. Now I know for sure that there is nothing wrong with Django or me. It's relief :)

Re: Importing Excel/CVS into Database

2007-08-21 Thread Amirouche
On Aug 21, 8:37 pm, robo <[EMAIL PROTECTED]> wrote: > Have any of you guys imported excel/cvs by using Python/Django? I need > to import 1000 products for a shopping site and I'd like to learn the > fastest and easiest way to do so. I already did this, but in another way. 1. I write Models, 2.

Re: Mod_Python and Apache

2007-08-21 Thread Graham Dumpleton
The official mod_python mailing list details are at www.modpython.org. You posted to the mod_python Google group which no one uses. Also look through: http://blag.whit537.org/2007/07/freebsd-threads-apache-and-modwsgi.html and specifically the other pages it links to. You may need to work out

Re: index page

2007-08-21 Thread jake
Rufman wrote: > do you by any chance know how the django admin page gets the help_text > from the model...e.i. how can i get the help_text without having to > define it again in my custom form? you can use something like: >>> modelinstance._meta.get_field('myfield').help_text where modelinstanc

Re: Initial value for a choices field in admin?

2007-08-21 Thread jake
hi amit, Amit Ramon wrote: > units = models.CharField(maxlength=2, choices=UNITS) > > When I try to create a new instance of this model in the admin, the initial > value in the select list for the units field is a dashed line. What I'd like > is to be able to define an initial value for this f

using django components outside of django

2007-08-21 Thread Lee Connell
I was wondering if it was easy and if there are examples of using django's ORM and even the authentication system in contrib outside of django, say in a twisted network application? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: using django components outside of django

2007-08-21 Thread James Bennett
On 8/21/07, Lee Connell <[EMAIL PROTECTED]> wrote: > I was wondering if it was easy and if there are examples of using > django's ORM and even the authentication system in contrib outside of > django, say in a twisted network application? http://groups.google.com/group/django-users/search?group=d

Re: Tip:decorator and urls.py

2007-08-21 Thread !张沈鹏(电子科大 08年毕业)
I think do like below maybe more simple from django.shortcuts import render_to_response from django.template.context import RequestContext def template_name(func): def _template_name(request,template_name,*args,**keys): result=func(request,*args,**keys) if type(result)!=dict

Re: chinese django forum

2007-08-21 Thread CorbeChen
Good! I am also a chineses, good work! On 8月22日, 上午12时15分, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hi,list > I think there are many chinese django users,i think we can > exchange info herehttp://forum.devshare.org. > Make it the most popular django forum in china.Good luck all :)

Re: GoFlow: a workflow engine for django

2007-08-21 Thread CorbeChen
excellent! but almost us only read englist, pls translate you doc to englist! On 8月21日, 上午6时01分, MiloZ <[EMAIL PROTECTED]> wrote: > Hi, > I'm just starting a workflow engine for django, based on Zope2 > openflow product. > > Home:http://django-goflow.blogspot.com/(in french) > Dev trac:https://o

Re: Mod_Python and Apache

2007-08-21 Thread Sasha Weberov
On Aug 21, 5:43 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > The official mod_python mailing list details are atwww.modpython.org. > You posted to the mod_python Google group which no one uses. > > Also look through: > > http://blag.whit537.org/2007/07/freebsd-threads-apache-and-modwsgi.ht

Re: ugettext vs. ugettext_lazy

2007-08-21 Thread Malcolm Tredinnick
On Tue, 2007-08-21 at 21:25 +0200, Tomas Kopecek wrote: > Malcolm Tredinnick napsal(a): > > makes 's1' a Unicode object. It's value will be based on the locale when > > it is executed and then never change, no matter what the locale is. So > > anything that is executed at *import* time should not

Re: insert or update

2007-08-21 Thread Malcolm Tredinnick
On Tue, 2007-08-21 at 16:33 -0400, George Vilches wrote: > Lic. José M. Rodriguez Bacallao wrote: > > how can I vote? > > There's no official voting mechanism for the non-Django developers > right now, it's mostly just based on putting a comment on the Trac > ticket Please don't do this. It's

Re: age in years calculation

2007-08-21 Thread Brian Rosner
There isn't a solution to your particular problem. Your problem is that you are accepting invalid data. Nobody can be born on a day that doesn't exist. I'd recommend verifying that the data be entered into the database is valid. On Aug 3, 5:37 am, Bram - Smartelectronix <[EMAIL PROTECTED]> wro

Re: age in years calculation

2007-08-21 Thread Brian Rosner
Err, my bad. I wasn't thinking. I need to stop writing replies after having a few beers. ;) On Aug 21, 9:09 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > There isn't a solution to your particular problem. Your problem is > that you are accepting invalid data. Nobody can be born on a day that

Re: insert or update

2007-08-21 Thread r_f_d
As far as insert or update, just overide the save method within the class. It is something that must be done for each class, but what I have done (for essentially the same purpose) is override save() on each model I need to log the action for like so: def save(): # if id exists, this record

Re: insert or update

2007-08-21 Thread George Vilches
r_f_d wrote: > As far as insert or update, just overide the save method within the > class. It is something that must be done for each class, but what I > have done (for essentially the same purpose) is override save() on > each model I need to log the action for like so: > > def save(): > #

Multiple one-to-one relationships for a single class

2007-08-21 Thread Catriona
Hello Is it possible to have multiple one-to-one relationships for a single class or is there a better way to do it. What I have is an event which has about 12 fields. Optionally any combination of a single weather record, a single event detail record, a single survey record and one of four even

Re: Multiple one-to-one relationships for a single class

2007-08-21 Thread Malcolm Tredinnick
On Tue, 2007-08-21 at 21:21 -0700, Catriona wrote: > Hello > > Is it possible to have multiple one-to-one relationships for a single > class or is there a better way to do it. Not at the moment, no. OneToOneFields assume they are going to be the primary key, so you're restricted to a single one.

Re: Initial value for a choices field in admin?

2007-08-21 Thread Amit Ramon
Thanks Jake. It works like a charm. I thought I tried this before, so I obviously made some mistake. Thanks, Amit > > hi amit, > > Amit Ramon wrote: > > units = models.CharField(maxlength=2, choices=UNITS) > > > > When I try to create a new instance of this model in the admin, the initial

Re: Multiple one-to-one relationships for a single class

2007-08-21 Thread Catriona
Hi Malcolm Thanks for the awesomely quick reply. I'll give the foreign key option a go for now and maybe dive deep later. I'm assuming that I could check for say an existing event detail record when I try and create a new one as well - probably cause less user angst. Thanks again Catriona On

Re: How to make a mapping/alias db table? (many-to-many)

2007-08-21 Thread Russell Keith-Magee
On 8/22/07, b3n <[EMAIL PROTECTED]> wrote: > > I've had 20 tabs open all day, all displaying django docs - but I > can't work this out. > > A bookmark can have many categories, and a category can be in many > bookmarks. So I just want a simple table that consists of > category_id, bookmark_id > >