Dependent Fields in Admin

2006-03-30 Thread bradford
In my admin I am trying to create a new object, A. A has a FK to B, which has a FK to Category, as shown: A -> B-> Category. The problem is that when I create a new A object in my admin, it only shows a drop down for B, and there you can have multiple B titles, but just not for the same

Re: how to do this kind of JOIN

2006-03-30 Thread Russell Keith-Magee
On 3/31/06, sam <[EMAIL PROTECTED]> wrote: I would like to get help on how to use Django DB API to accomplish theequivalent of the following SQL statement:select a from X, Y where X.f = Y.id and Y.c=123;X has field a, f and Y has field id, c. f is foreign key of Y and Y's primary key is id.Its a

how to do this kind of JOIN

2006-03-30 Thread sam
I would like to get help on how to use Django DB API to accomplish the equivalent of the following SQL statement: select a from X, Y where X.f = Y.id and Y.c=123; X has field a, f and Y has field id, c. f is foreign key of Y and Y's primary key is id. Thanks in advance.

Re: How to get vote total in poll tutorial

2006-03-30 Thread Adam
You're dancing all around it. I'm pretty sure its: poll__id__exact=1 (two underscores both times) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Overthinking urls.py?

2006-03-30 Thread Glenn Tenney
On Thu, Mar 30, 2006 at 03:07:01PM -0500, Max Battcher wrote: > I hate to say it, but Routes and most of the other schemes presented > _do_ feel over-engineered. The current URL patterns system is fast > and clean. The get_absolute_url() pattern is simple one, and yes it > might break the

edit_inline on the other end of the OneToOneField

2006-03-30 Thread medhat
Hello, I used edit_inline with a OneToOneField and it worked. I am trying to extend the user model, but with multiple OneToOneField models. For example, I might have an Employee model that has a OneToOneField to User, and a Customer model with a OneToOneField to User. Now, if I add

Re: Overthinking urls.py?

2006-03-30 Thread Doug Van Horn
> I hate to say it, but Routes and most of the other schemes presented > _do_ feel over-engineered. The current URL patterns system is fast > and clean. I actually agree 100%. And my earlier post indeed smacks of overengineering. And in my current smallish project I don't intend to do any of

Re: ContentType in magic removal :: how to?

2006-03-30 Thread arthur debert
thanks a lot Jacob, I WAS missing the obvious. --~--~-~--~~~---~--~~ 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

Re: Set WOrking directory with mod_python

2006-03-30 Thread Jacob Kaplan-Moss
On Mar 30, 2006, at 3:45 PM, [EMAIL PROTECTED] wrote: > This is probably a really trivial question. > How do I set my Django app's current working directory when running > under mod_python? The "correct" answer is that you shouldn't be relying on the working directory in a web app; use

Re: ContentType in magic removal :: how to?

2006-03-30 Thread Jacob Kaplan-Moss
On Mar 30, 2006, at 2:50 PM, arthur debert wrote: > sorry if this is too basic. ;-( , am I missing the obvious? > wouldn't a get_content_type() static method make sense for all model > classes? You want ContentType.objects.get_for_model(MyModel) Jacob

Set WOrking directory with mod_python

2006-03-30 Thread [EMAIL PROTECTED]
Hi. This is probably a really trivial question. How do I set my Django app's current working directory when running under mod_python? I have a view which loads local files and includes their content in a directory. When running under the development server, this works fine. Running under

applying strip() to submitted formfield values, especially numerics

2006-03-30 Thread pbx
I had a frustrated user today whose seemingly valid input into an IntegerField was getting rejected at the validation step (using my model's default manipulator). We eventually discovered a stray space at the end of his input. Is there a reason that formfield values destined for numeric Django

ContentType in magic removal :: how to?

2006-03-30 Thread arthur debert
Hi. I am trying to get a model's content type in magic-removal. I have a model's instance when I try : ContentTypeManager().get_for_model(instance) I get : AttributeError: 'NoneType' object has no attribute 'DoesNotExist' I got it working with: def get_content_type(model): opts =

validator for whole form

2006-03-30 Thread JirkaJ
Hello, i would like to make some validation for whole form, not just only for one field in admin. Is it possible? st like def _manipulator_validate_form... thanks JJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Overthinking urls.py?

2006-03-30 Thread Max Battcher
On 3/30/06, ToddG <[EMAIL PROTECTED]> wrote: > > I'm not sure if this was earlier missed or ignored by people [nobody > explictly ruled it out], I can't help but think Django's URL handling > will either drift towards re-implementing Routes: > http://routes.groovie.org/ or staying as it is.

Re: urls.py changes ignored

2006-03-30 Thread Rock
I found a tiny difference in the http.conf files (AllowOveride was set to "FileInfo" instead of "None".) I made that change, even though I seriously doubted that it would make a difference. Then I bounced apache and amazingly enough the new urls.py showed up. I set the AllowOverride setting back

Re: Overthinking urls.py?

2006-03-30 Thread ToddG
I'm not sure if this was earlier missed or ignored by people [nobody explictly ruled it out], I can't help but think Django's URL handling will either drift towards re-implementing Routes: http://routes.groovie.org/ or staying as it is. (note the lastest version has a nice feature where you can

Re: urls.py changes ignored

2006-03-30 Thread medhat
Rock wrote: > Yes I did. No help. > > Then I forced the creation of a new urls.pyc by importing urls.py in > "python manage.py shell" and importing urls.py and explicitly checking > that the correct number of urlpatterns were defined. Still no joy in > the browser though. > > Note that the

Re: urls.py changes ignored

2006-03-30 Thread Don Arbow
On Mar 30, 2006, at 9:35 AM, Rock wrote: > Then I forced the creation of a new urls.pyc by importing urls.py in > "python manage.py shell" and importing urls.py and explicitly checking > that the correct number of urlpatterns were defined. Still no joy in > the browser though. > > Note that the

Re: urls.py changes ignored

2006-03-30 Thread Rock
Yes I did. No help. Then I forced the creation of a new urls.pyc by importing urls.py in "python manage.py shell" and importing urls.py and explicitly checking that the correct number of urlpatterns were defined. Still no joy in the browser though. Note that the access_log shows my request but

Re: Admin interface using CharField as a primary key

2006-03-30 Thread Daniel Bimschas
Forgot: In the trunk the problem also exists. 2006/3/30, Daniel Bimschas <[EMAIL PROTECTED]>: > If have a model like this: > > class Article(meta.Model): > cite_key = meta.CharField(maxlength=255, primary_key=True) > ... > > where "cite_key" is a unique string used in a

Re: Admin interface using CharField as a primary key

2006-03-30 Thread Daniel Bimschas
If have a model like this: class Article(meta.Model): cite_key = meta.CharField(maxlength=255, primary_key=True) ... where "cite_key" is a unique string used in a bibtex-file. The problem now are the links to the edit pages created by the admin interface. The html-code is

Re: Overthinking urls.py?

2006-03-30 Thread Doug Van Horn
I'm going to type out loud for a little bit. I'm hoping to better define the problem so we can think about solutions more clearly (or go find ones as solved by other frameworks). Django has the concept of an application, a reusable chunk of functionality which can be reused in many different

urls.py changes ignored

2006-03-30 Thread Rock
I have a development site where I can update myproject.urls.py and the changes are acted upon immediately by my server. I just cloned this site onto another computer and everything seems to be in order except that on this new system, changes to urls.py are entirely ignored. Nothing I do seems to

Re: Admin interface using CharField as a primary key

2006-03-30 Thread Andy Dustman
On 3/30/06, Daniel Bimschas <[EMAIL PROTECTED]> wrote: > > Hi there! > > I'm currently trying to convert an old webapp written in PHP into a > django-based app. The PHP-System used VARCHAR-Fields as primary keys > in the MySQL - DB. > > Now, if i convert the data for the new tables created by

Re: logging

2006-03-30 Thread Michael Radziej
Jacob Kaplan-Moss schrieb: > Yeah, Python's logging module should do everything you need. If not, re-read the docs ;-) Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: logging

2006-03-30 Thread Jacob Kaplan-Moss
On Mar 29, 2006, at 8:03 PM, Brian Elliott wrote: > Is there a recommended way to do logging in a production > environment? Should I just use Python's logging module or is there a > built-in way to do this? (I am using the M-R branch.) Yeah, Python's logging module should do everything you

Admin interface using CharField as a primary key

2006-03-30 Thread Daniel Bimschas
Hi there! I'm currently trying to convert an old webapp written in PHP into a django-based app. The PHP-System used VARCHAR-Fields as primary keys in the MySQL - DB. Now, if i convert the data for the new tables created by Django, I have the problem that the admin interface can't edit any

Re: follow relationship

2006-03-30 Thread Todd O'Bryan
Thanks a lot! I would have tried to do something with tuples, but this seems to make easy sense.ToddOn Mar 30, 2006, at 6:06 AM, Ned Batchelder wrote: Sorry, sent the email before the formatting was right: class K:     def __init__(self, label=None, **kwargs):     assert(len(kwargs) == 1)    

Re: follow relationship

2006-03-30 Thread Ned Batchelder
And there's a bug!  The body of choices() should be: def choices(self): return [(k.v, k.label) for k in self.klist] Ned Batchelder wrote: Sorry, sent the email before the formatting was right: class K:     def __init__(self, label=None, **kwargs):    

Re: follow relationship

2006-03-30 Thread Ned Batchelder
Sorry, sent the email before the formatting was right: class K:     def __init__(self, label=None, **kwargs):     assert(len(kwargs) == 1)     for k, v in kwargs.items():     self.id = k     self.v = v     self.label = label or self.id class Constants:     def

Re: manipulator.save() and manytomany relationship

2006-03-30 Thread limodou
On 3/30/06, yml <[EMAIL PROTECTED]> wrote: > > This is an amazing tip. I didn't know that I could print messages in > the runserver console. > I was missing that a lot. this is eaxcltly were the problem is for some > unknown reason the information is correct in new_data but when I am > retrieving

Re: manipulator.save() and manytomany relationship

2006-03-30 Thread yml
This is an amazing tip. I didn't know that I could print messages in the runserver console. I was missing that a lot. this is eaxcltly were the problem is for some unknown reason the information is correct in new_data but when I am retrieving new_data['localisation'] I got only the last piece of

Re: manipulator.save() and manytomany relationship

2006-03-30 Thread limodou
On 3/30/06, yml <[EMAIL PROTECTED]> wrote: > > Your suggestion give the same result: > temp.set_localisation(map(int,new_data['localisation'])) > > Only the last selected localisation is saved. > > I think you can print new_data['localisation'] to see if it's what you want. -- I like python! My

Re: manipulator.save() and manytomany relationship

2006-03-30 Thread yml
Your suggestion give the same result: temp.set_localisation(map(int,new_data['localisation'])) Only the last selected localisation is saved. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: manipulator.save() and manytomany relationship

2006-03-30 Thread yml
I have added an additional temp.save. First I create the Profile with the mandatory attributes then I add the optional ones if they exist. This seems to work, I mean I do not get an error message when clicking on submit. My problem is now that even if I multi select localisation I only save the