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 la

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 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
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 t

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
Thank you you are amazing here it the solution = if new_data['localisation']: print "new_data contains : " +str(new_data) loc=new_data.getlist('localisation') print 'loc : '+str(loc) print "new_data['localisation'] co

Re: follow relationship

2006-03-30 Thread Ned Batchelder
The choices= attribute in the model defines what goes into the select box.  In this case, Constants.choices() returns a list based on the values based to the Constants constructor.  My example below has it backwards for integers. It should be: def choices(self): return [(v,k) for k

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 __in

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):     assert(len(kwa

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: manipulator.save() and manytomany relationship

2006-03-30 Thread limodou
On 3/30/06, yml <[EMAIL PROTECTED]> wrote: > > Thank you you are amazing > > here it the solution > = > if new_data['localisation']: > print "new_data contains : " +str(new_data) > loc=new_data.getlist('localisation') > print 'lo

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 entrie

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 need

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: 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 Djan

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: 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 pro

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 fo

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 bibt

Re: urls.py changes ignored

2006-03-30 Thread James Bennett
On 3/30/06, Rock <[EMAIL PROTECTED]> wrote: > What else should I be looking at? Did you nuke urls.pyc? -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscrib

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 t

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 ac

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 access_

Re: moving items in admin-interface

2006-03-30 Thread Wilson Miner
Have you looked at the "order_with_respect_to" meta option in your model? On 3/30/06, patrickk <[EMAIL PROTECTED]> wrote: > > i´m just trying to implement buttons for moving up/down elements in > the admin-interface (which should be replaced with ajax-drag later on). > therefore, my model has a f

Re: Model inheritance

2006-03-30 Thread Andy Dustman
On 3/25/06, James Bennett <[EMAIL PROTECTED]> wrote: > > On 3/25/06, Andy Dustman <[EMAIL PROTECTED]> wrote: > > Surprisingly (a bit, at least), I created an app with the example model: > > ..snip... > > > Which is not what you'd expect based on that page, so presumably the > > changes haven't bee

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 p

Re: urls.py changes ignored

2006-03-30 Thread Rock
On my development machine I do not have to restart the webserver to have the changes enforced. In any event, I have tried restarting the webserver and also dumping the cache in my browsers without effect. There is no reason to suspect an error with the cloned urls.py file as it is an exact copy

Re: moving items in admin-interface

2006-03-30 Thread patrickk
yes, i tried it but i could never get it to work (neither with 0.91 nor with MR, using MySQL 4.1 ... 5.0). i always get a mysql-error. patrick Am 30.03.2006 um 20:59 schrieb Wilson Miner: > > Have you looked at the "order_with_respect_to" meta option in your > model? > > On 3/30/06, patric

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 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. (note

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 Groups

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 = model.

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 mo

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 mod_pyt

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 --~--~-~--~~~--

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 absolute

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 group,

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 t

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 'edit_inline'

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 "perfe

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 django-us

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 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 li

Re: Overthinking urls.py?

2006-03-30 Thread Max Battcher
On 3/30/06, Glenn Tenney <[EMAIL PROTECTED]> wrote: > But, it didn't seem to get any comments pro or con, so let me try again: > > I believe that the Model should have a common method used > to get a PART of a URL, the part that locates this object. That part > of the URL might be "place/" or "po

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 Categor

mini-wiki advice

2006-03-30 Thread shredwheat
I want a pages of my site to be editable by signed in members. This seems simple enough, but I'm not sure of the best strategy. This does not need to be a full on wiki style system, since the number of pages will be fixed and only about 10 or so. The main goals I am after: - simple text markup