Re: newbie: object from maniputor versus set_foo.add( )

2006-06-13 Thread Ivan Sagalaev
Bram de Jong - MTG wrote: > Right now I do: > > def post_comment(request, blog_id): > [snip] > > blog_post = BlogPost.objects.get(id__exact=blog_id) # from URL > > # If data was POSTed, we're trying to create a new Comment. > new_data = request.POST.copy() > > #

Re: Importing several thousand records into a database

2006-06-13 Thread Eric Walstad
On Tuesday 13 June 2006 11:44, keukaman wrote: > I'd like to import several thousand records, in CSV format, into an > existing postgres table. Does anyone know a utility that would allow me > to do this? Hey keukaman, I had to struggle with a system of regularly importing around 1.5 million re

Re: Basic Question: add/edit multiple instances of a model in one form?

2006-06-13 Thread char
I'm curious about this too. --~--~-~--~~~---~--~~ 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 [EMA

Re: url path in django template

2006-06-13 Thread Steven Armstrong
On 06/14/06 05:45, damacy wrote: > hi, there. > > is there any built-in function which retrieves the current url in a > django template? > > for instance, if my current url is > > http://www.lalala.com/hoho?index=0 > > and i'd like to get the exactly same url as above within a template > (incl

Re: unable to do an svn co

2006-06-13 Thread lawgon
lawgon wrote: > it may be something to do with http proxy as even my laptop is affected > now. I will check out (when the sysadmin turns up) and revert. nope, tried with another machine not behind a proxy and was unable to checkout or do an svn update either. I have tried with svn 1.1.4 and 1.2.

url path in django template

2006-06-13 Thread damacy
hi, there. is there any built-in function which retrieves the current url in a django template? for instance, if my current url is http://www.lalala.com/hoho?index=0 and i'd like to get the exactly same url as above within a template (including hoho?index=0). i can get the current directory w

Re: unable to do an svn co

2006-06-13 Thread lawgon
it may be something to do with http proxy as even my laptop is affected now. I will check out (when the sysadmin turns up) and revert. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
I just fired off a message to Django-dev, asking for ideas for a new FileField API. If anyone was reading this thread and is interested in such a thing, come to Django-dev and help me out. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subs

Re: unable to do an svn co

2006-06-13 Thread Ian Holsman
hi lawgon. what version of SVN are you using? (I can do a update on my box) someone else was reporting the same error a couple of days ago on irc. On 14/06/2006, at 12:37 PM, lawgon wrote: > > hi, > on a new ubuntu machine i tried to do an svn co and am getting the > following error: > > svn:

unable to do an svn co

2006-06-13 Thread lawgon
hi, on a new ubuntu machine i tried to do an svn co and am getting the following error: svn: REPORT request failed on '/svn/!svn/bc/3124/django/trunk' svn: REPORT of '/svn/!svn/bc/3124/django/trunk': 400 Bad Request (http://code.djangoproject.com) any clues? kg --~--~-~--~~---

Re: Importing several thousand records into a database

2006-06-13 Thread Joshua D. Drake
keukaman wrote: > I'd like to import several thousand records, in CSV format, into an > existing postgres table. Does anyone know a utility that would allow me > to do this? If you are literally only doing a couple of thousand, I would use the CSV module for Python and create a single transactio

Re: Accessing logged-in user object in models

2006-06-13 Thread Nuno Mariz
foo.updater = request.user ? In each view of Admin? Todd O'Bryan wrote: > You don't want to save the user id explicitly. Your model should be > > updater = models.ForeignKey(User) > > Since you'll be setting the updater (or some other better word) from > within a view, you'll have access to t

Re: Accessing logged-in user object in models

2006-06-13 Thread Todd O'Bryan
You don't want to save the user id explicitly. Your model should be updater = models.ForeignKey(User) Since you'll be setting the updater (or some other better word) from within a view, you'll have access to the currently logged-in user. Just do foo.updater = request.user and you're good t

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread Eugene Lazutkin
Bryan Murdock wrote: > > As for Eugene's example, firefox does display it, and confirms that > the content-type header was application/xml. That isn't what django > sets for Rss201rev2Feeds. Maybe, Eugene, you are overriding that > somewhere in your code? Yes, I override it. I remember having

Re: Root URI in templates

2006-06-13 Thread Scott Anderson
On Tue, 2006-06-13 at 18:59 -0500, James Bennett wrote: > On 6/13/06, ChrisW <[EMAIL PROTECTED]> wrote: > It's not that "media" and "structure" are separated, it's that with > Apache/mod_python it's better for performance reasons to use a > separate web server for media files, stylesheets and Java

Re: Root URI in templates

2006-06-13 Thread limodou
On 6/14/06, ChrisW <[EMAIL PROTECTED]> wrote: > > Let me rephrase this. I don't disagree with absolute URL's per se, but > there should be someway of abstracting them further than is currently > available. > > Lets say that your media server's address changes, doesnt it seem silly > to have to go

Re: Root URI in templates

2006-06-13 Thread ChrisW
James, Thank you for your replies. > settings.MEDIA_URL contains info on this; if you're worried about that > use it to build up the links (e.g., write a templatetag that pulls it > in, or a context processor that puts it in the template context. I had thought of doing this, but after not seein

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread James Bennett
On 6/13/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > And it sets them just as James indicates. That probably explains why > firefox isn't displaying them like I wish. Firefox is doing the right thing. Displaying raw XML to an end user is not a good thing, and is more likely to make the user th

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread James Bennett
On 6/13/06, coulix <[EMAIL PROTECTED]> wrote: > applocation/rss+xml is what appears in the http headers. > It does not get display as an xml doc however :/ This is because browsers are NOT supposed to display feeds as XML documents. Think of it like PDF -- instead of displaying the raw source te

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread Bryan Murdock
On 6/13/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > On 6/13/06, James Bennett <[EMAIL PROTECTED]> wrote: > > > > On 6/12/06, Eugene Lazutkin <[EMAIL PROTECTED]> wrote: > > > I suspect the difference is > > > due to different MIME type of these feeds --- I use 'application/xml', > > > which I be

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread coulix
applocation/rss+xml is what appears in the http headers. It does not get display as an xml doc however :/ http://127.0.0.1:8000/feeds/nouvelles/ GET /feeds/nouvelles/ HTTP/1.1 Host: 127.0.0.1:8000 User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 A

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread James Bennett
On 6/13/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > So are those the MIME types that django is returning for rss feeds (in > other words, how do I find out what MIME type django is using for > these)? In that case and from what you are saying, firefox is doing > the correct thing in asking me

Re: Root URI in templates

2006-06-13 Thread James Bennett
On 6/13/06, ChrisW <[EMAIL PROTECTED]> wrote: > Lets say that your media server's address changes, doesnt it seem silly > to have to go through ALL of your templates to change those absolute > URL's? settings.MEDIA_URL contains info on this; if you're worried about that use it to build up the lin

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread Bryan Murdock
On 6/13/06, James Bennett <[EMAIL PROTECTED]> wrote: > > On 6/12/06, Eugene Lazutkin <[EMAIL PROTECTED]> wrote: > > I suspect the difference is > > due to different MIME type of these feeds --- I use 'application/xml', > > which I believe is the correct one. > > application/rss+xml for RSS > appli

Re: Root URI in templates

2006-06-13 Thread ChrisW
Let me rephrase this. I don't disagree with absolute URL's per se, but there should be someway of abstracting them further than is currently available. Lets say that your media server's address changes, doesnt it seem silly to have to go through ALL of your templates to change those absolute URL'

Re: Root URI in templates

2006-06-13 Thread James Bennett
On 6/13/06, ChrisW <[EMAIL PROTECTED]> wrote: > I also noticed that the djangoproject webistes templates are full of > absolute hrefs to stylesheets and other *media*. Does anyone else think > this is a bad idea? Why is it a bad idea to have a site's templates reference that site's stylesheets an

Re: Accessing logged-in user object in models

2006-06-13 Thread Nuno Mariz
Ok, I agree. But if I want to save the ID of the user logged-in in a field in my table, I can't. Basically in almost of my tables I will have this fields: ip (IP Address) last_update (Record last update) user_id (User id that make the change) Don Arbow wrote: > On Jun 13, 2006, at 7:58 AM, [EMA

Re: Root URI in templates

2006-06-13 Thread ToddG
I don't know the status but read this to see some past thoughts on the topic: http://groups.google.com/group/django-developers/browse_thread/thread/a5d12bc4fb073f24/83d7e4cb5f35ed08 There are other threads pre-dating that one as well... --~--~-~--~~~---~--~~ You

Re: Root URI in templates

2006-06-13 Thread ChrisW
bump :) I also noticed that the djangoproject webistes templates are full of absolute hrefs to stylesheets and other *media*. Does anyone else think this is a bad idea? ChrisW. plungerman wrote: > greetings, > > in an attempt to better understand, django from a systems perspective, > i have bee

Re: howto Django + lighttpd + Windows?

2006-06-13 Thread Istvan
> Other reason? Because this option exist! It does not. Lighttpd fastcgi does not work on windows. i. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

_manipulator_validate_FIELD

2006-06-13 Thread David S.
Is there a replacement for the old _manipulator_validate_FIELD magic in the post 0_91 trunk? If you can not make an instance method, then you lose, for example, "hasattr(self, "original_object")". Thanks, David S. --~--~-~--~~~---~--~~ You received this message

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Thanks a lot, Jay. I'll smack Jacob over the head (I don't actually > know if he wrote that or not, but any excuse to smack him is a good > one) and point him to your ticket. Thanks a lot! > > Jeff Note that my ticket (1994) isn't a sol

Re: Getting a foreign key from a recursion relation model

2006-06-13 Thread SmileyChris
Try models.STACKED then. I'm guesing the task doesn't need to change the client, just show it? If so, you could make a method that gets the client (return self.project.client.name) and add that to the fields to list in admin view. Read up on http://www.djangoproject.com/documentation/model_api/#ad

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread [EMAIL PROTECTED]
Thanks a lot, Jay. I'll smack Jacob over the head (I don't actually know if he wrote that or not, but any excuse to smack him is a good one) and point him to your ticket. Thanks a lot! Jeff --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: howto Django + lighttpd + Windows?

2006-06-13 Thread mamcxyz
Nothing... but I wanna test the things localy, and for example do a load testing, something like emulate 1000 users hitting the site and that kind of fun (yes, I specting a decent workload!!) Also, because I wanna use ligthttpd in the production server is best keep the things equal. Other reason

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
On 6/13/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 6/13/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 6/13/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > > I don't know if this was on purpose, or if it was simply forgotten, > > > but I suggest you walk over to the desk of whoever wrote

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jeremy Dunck
On 6/13/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > On 6/13/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > I don't know if this was on purpose, or if it was simply forgotten, > > but I suggest you walk over to the desk of whoever wrote that, and > > smack them on the head :) > > Perhaps refactor

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jeremy Dunck
On 6/13/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > I don't know if this was on purpose, or if it was simply forgotten, > but I suggest you walk over to the desk of whoever wrote that, and > smack them on the head :) Perhaps refactor to UploadField or somesuch while you're at it. ;-) --~--~

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Nope, looks like neither FileField nor ImageField work for me. Ok, I got it figured out: Interestingly enough, create_object works just fine. update_object, as you've noted, doesn't. The reason is that in a Django 'request' object, a

Re: error in your SQL syntax near '(DATE_FORMAT... on adding date_hierarchy = 'pub_date'

2006-06-13 Thread JHeasly
Andy Dustman wrote: > ... [snip] ... > Your original error was: "You have an error in your SQL syntax near > '(DATE_FORMAT(`polls_poll`.`pub_date`, '%Y-01-01 00:00:00') AS > DATETIME) FROM `p' at line 1" I'm going to guess that the bit before > the leading parenthesis is "CAST", and CAST() does

encoding of form variables in views

2006-06-13 Thread Pistahh
Hi, I have a view processing a form: def contact(request): manipulator = ContactManipulator () if request.POST: data = request.POST.copy() errors = manipulator.get_validation_errors (data) if not errors: manipulator.do_html2python(data)

Re: How to do named HTML anchors with Django?

2006-06-13 Thread [EMAIL PROTECTED]
Ahh yes. I knew that. Just typed it wrong. :) --~--~-~--~~~---~--~~ 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: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread [EMAIL PROTECTED]
Nope, looks like neither FileField nor ImageField work for me. --~--~-~--~~~---~--~~ 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

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > The images are not getting uploaded at all. They are still zero files > in my upload path on the server. :) Out of curiosity, if you change your model to use FileField instead of ImageField, does it work? Jay p --~--~-~--~

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread [EMAIL PROTECTED]
The images are not getting uploaded at all. They are still zero files in my upload path on the server. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: How to do named HTML anchors with Django?

2006-06-13 Thread James Bennett
On 6/13/06, Luke Plant <[EMAIL PROTECTED]> wrote: > Otherwise the CommonMiddleware will do a redirect to add the trailing > slash that will strip the fragment. Or set APPEND_SLASH to False. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > It actually turns out that the mimetype encoding was NOT the problem. I > did forget to do it, but when i added it, it still no workie. > > Either I don't understand how to do something here, or there's a bug in > update_object. Jeff, c

Re: How to do named HTML anchors with Django?

2006-06-13 Thread Luke Plant
On Tuesday 13 June 2006 18:46, ZebZiggle wrote: > Sorry if this a really silly question everyone, but how do I jump to > named anchor with the URL mapping of Django? > > I have a template that uses targets and want to go to > a specific target from another page /mypage#foo Yep, you need to spell

Re: How to do named HTML anchors with Django?

2006-06-13 Thread [EMAIL PROTECTED]
Sandy- Django doesn't get involved here at all. Just point your links to /mypage#foo and they'll work fine. Django doesn't even know about your named anchors. :) BTW, you may want to consider switching your name attributes to ids, instead (i.e. ). Names are pretty old-school and is actually depr

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread [EMAIL PROTECTED]
It actually turns out that the mimetype encoding was NOT the problem. I did forget to do it, but when i added it, it still no workie. Either I don't understand how to do something here, or there's a bug in update_object. --~--~-~--~~~---~--~~ You received this me

Re: Importing several thousand records into a database

2006-06-13 Thread aaloy
Python itself could do it. Of course ;) Just be sure not to create a transaction for every record, as it would be terribly slow. One transaction every 5.000 record works for me on an import of ~150.000 records. I didi it with the DB Api. To be honest I haven't tested directly with Django. Best

Re: Importing several thousand records into a database

2006-06-13 Thread Don Arbow
The psql utility will do that for you. You can specify the field and record separator on the command line. You can prefix your data with the COPY command and it will get slurped right into the database. Note that the default value for null columns is \N, but you can specify a different valu

Importing several thousand records into a database

2006-06-13 Thread keukaman
I'd like to import several thousand records, in CSV format, into an existing postgres table. Does anyone know a utility that would allow me to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jay Parlar
On 6/13/06, Viktor <[EMAIL PROTECTED]> wrote: > > I have a problem with an update_object generic view and ImageField. The > create_object view works great, but update_object doesn't upload the > image?! I set the mimetype ;) > > here is the snippet from my object_form.html template (both > create_

How to do named HTML anchors with Django?

2006-06-13 Thread ZebZiggle
Sorry if this a really silly question everyone, but how do I jump to named anchor with the URL mapping of Django? I have a template that uses targets and want to go to a specific target from another page /mypage#foo Is this possible? If so, how? Thx, Sandy --~--~-~--~~---

Re: MyFormWrapper.myfield works in {{}} but not {%%} ?

2006-06-13 Thread Luke Plant
On Tuesday 13 June 2006 13:36, mazurin wrote: > Thanks. I think I figured it out. It's not the expr tag, it's {%%}. > It seems that {%%} doesn't cause a form field to render into HTML the > way {{}} does. {%%} by itself doesn't do anything -- the only bit of data that is extracted and handled is

Re: help with constructing a query

2006-06-13 Thread medhat
Thanks, I understood the sql solution on your blog... but still can't figure out how to map that to django... waiting to read your next blog post :-) -- Medhat Malcolm Tredinnick wrote: > On Mon, 2006-06-12 at 12:09 -0700, medhat wrote: > > Hi, > > > > If you have a many-to-many field, let's say

Re: error in your SQL syntax near '(DATE_FORMAT... on adding date_hierarchy = 'pub_date'

2006-06-13 Thread Andy Dustman
On 6/12/06, Matt McClure <[EMAIL PROTECTED]> wrote: > > I received in a private email: > > Hello Matthew, > > > > I'm seeing the exact same "date_hierarchy" problem and was wondering > > if you received a solution offline and/or figured it out. > > > > Seems like the problem is somewhere among my

Re: hello & question (sorting related cmodels)

2006-06-13 Thread DavidA
Bram, You can add this to your model: class Meta: ordering = ('name',) Here is the documentation: http://www.djangoproject.com/documentation/models/ordering/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

Re: howto Django + lighttpd + Windows?

2006-06-13 Thread Frankie Robertson
On 10/06/06, mamcxyz <[EMAIL PROTECTED]> wrote: > > I'm triying to use lighttpd for Windows, so I can test stuff localy and > then upload to linux. > What's wrong with the included django development server? --~--~-~--~~~---~--~~ You received this message because

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread James Bennett
On 6/13/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > Hey, I want one of those for my projects! ;) They can be expensive to keep. Food and shelter and caffeine and all that. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~--

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Viktor
I have a problem with an update_object generic view and ImageField. The create_object view works great, but update_object doesn't upload the image?! I set the mimetype ;) here is the snippet from my object_form.html template (both create_object and update_object use the same template):

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread Jeremy Dunck
On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Remembering that I work with most of the core Django developers, I > thought I'd ask those guys. Trurns out I made a stupid mistake and > forgot to multipart encode my form in my template. Doh! Hey, I want one of those for my projects!

Basic Question: add/edit multiple instances of a model in one form?

2006-06-13 Thread Dannoo
Basic Beginner Question Is it possible with built-in manipulators and FormWrappers to create a form that allows one to add/edit multiple instances of a model in one form. This is done in the admin when the model specifies edit-inline and num_in_admin greater than one. The admin form allows for t

Re: ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread [EMAIL PROTECTED]
Remembering that I work with most of the core Django developers, I thought I'd ask those guys. Trurns out I made a stupid mistake and forgot to multipart encode my form in my template. Doh! --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Guidance would be most welcome

2006-06-13 Thread DavidA
I have a similar problem where I want to maintain an audit trail for "manual overrides" to inputs to our risk loop. I haven't implemented it in Django yet, but the way I've done this in the past is similar to Waylan: using a history version of the table. There are a few differences, however. My ta

Re: Accessing logged-in user object in models

2006-06-13 Thread nm
Ok, I will give a try. Thanks all. Nuno Quoting Michael Radziej <[EMAIL PROTECTED]>: > > Don Arbow wrote: >> Then in the view that calls the template, you determine if the user >> is authorized to edit the field. > > You don't have a view function with an Admin page ... that doesn't work. > > B

Re: Generating models from a class diagram

2006-06-13 Thread spacedman
I'd rather go the other way - generate a class diagram from django model source! If you generate model code from a diagram you'll probably still have to edit the source to add new methods or tweak verbose_names, or add Admin meta classes, so then if you change the model you will lose all those ch

ImageField upload not working in django.views.generic.create_update.update_object?

2006-06-13 Thread [EMAIL PROTECTED]
I've got a simple form using the update_object generic view that seems to work great -- expect for the two image fields. They both work fine in the admin -- I can easily upload images to them. But, in the generic view form, images don't upload. I can select an image and submit the form just fine.

Re: Accessing logged-in user object in models

2006-06-13 Thread Michael Radziej
Don Arbow wrote: > Then in the view that calls the template, you determine if the user > is authorized to edit the field. You don't have a view function with an Admin page ... that doesn't work. But you could just redirect the Admin page to a view function (using the URL config) and from the

Re: Accessing logged-in user object in models

2006-06-13 Thread Don Arbow
On Jun 13, 2006, at 7:58 AM, [EMAIL PROTECTED] wrote: > > I have a problem then. > I just need to test if a user have permission to edit a field in > Admin. > Then in the view that calls the template, you determine if the user is authorized to edit the field. You can test the authorization i

newbie: object from maniputor versus set_foo.add( )

2006-06-13 Thread Bram de Jong - MTG
hi, More newbie questions. I have something similar to: class BlogPost: [...] class Comment: [...] blog_post = models.ForeignKey(BlogPost) Now, when POSTing a comment, I have to set the 'blog' of the comment to the right blog item. Right now I do: def post_comment(

Re: Accessing logged-in user object in models

2006-06-13 Thread nm
I have a problem then. I just need to test if a user have permission to edit a field in Admin. Quoting Michael Radziej <[EMAIL PROTECTED]>: > > [EMAIL PROTECTED] wrote: >> Hi, >> I need the access to the logged-in user object in a model, to verify >> permissions. >> How I do that? > > You can't.

Re: Foreignkey problem in admin interface

2006-06-13 Thread Nagy Károly
patrickk írta: >maybe this helps: >http://www.djangoproject.com/documentation/model_api/#blank > > Helps? Works! Thank you, Patrick. Charlie. -- "...s minden mestert kinevettem, ki nem nevetett önmagán." GPG public key: http://www.rendszergazda.com/gpg/charlie-gpg-public-key.asc --~--~---

Re: Accessing logged-in user object in models

2006-06-13 Thread Michael Radziej
[EMAIL PROTECTED] wrote: > Hi, > I need the access to the logged-in user object in a model, to verify > permissions. > How I do that? You can't. The model is decoupled from the http stuff and has no way to access it. Such kind of validations must be done in the Manipulator or view. There are

Re: ManyToMany, edit_inline and the Admin interface

2006-06-13 Thread martwine
Obviously I found the solution as soon as I posted here. I created an empty Admin inner class in the Authors model, which caused an add option to appear in the Publication admin page. There is now the option to edit Authors from top-level django admin, but this is fine. Sorry for cluttering up th

Re: Mod_python and Django - AGAIN

2006-06-13 Thread PythonistL
Yes, it uses the same source that runs on Dreamhost - both Django and my project. I had to make only some different settings in settings.py file because I installed the project in a different directory and also installed PIL and MySQLdb by myself. So, how to find the cause of the problem? L.

Re: Guidance would be most welcome

2006-06-13 Thread Paul Childs
Thanks for the input Waylan. It certainly gives me another angle on the solution. I have been digging into the docs again and it seems to me that Django is flexible enough to handle this without having to dive into the source. Of course it would be nice just to call the save() and delete() meth

Accessing logged-in user object in models

2006-06-13 Thread nm
Hi, I need the access to the logged-in user object in a model, to verify permissions. How I do that? I've tryed: from django.http import HttpRequest class xxx(models.Model): [...] request = HttpRequest() user = request.user Don't work. Thanks, Nuno --~--~-~--~

Re: Mod_python and Django - AGAIN

2006-06-13 Thread Waylan Limberg
Does it run with the devserver? Are you sure you are using the same versions of django and/or python on both machines. If not, it could be some syntax differences etc. I would check that first. Then, try Joseph's suggestions anyway. As he says it will "maybe give you an idea of where to focus."

Re: Guidance would be most welcome

2006-06-13 Thread Waylan Limberg
I have been thinking about how to do something similar - specifically, wikipage history. Note that I have not actually tried any of this yet but I would split the history out into a second table. Perhaps this incomplete example to illustrate: class Page(models.Model): title = models.C

Re: rss feeds from django handled differently by firefox

2006-06-13 Thread James Bennett
On 6/12/06, Eugene Lazutkin <[EMAIL PROTECTED]> wrote: > I suspect the difference is > due to different MIME type of these feeds --- I use 'application/xml', > which I believe is the correct one. application/rss+xml for RSS application/atom+xml for Atom Browsers should prompt to download on thes

ManyToMany, edit_inline and the Admin interface

2006-06-13 Thread martwine
Hi there, I have two classes related by a ManyToManyField - Publications and Authors. I want to be able to add entries to both tables through one page of the admin interface - as with edit_inline with ForeignKey relationships, i.e. when adding a new publication I want to be able to select from a

Re: Foreignkey problem in admin interface

2006-06-13 Thread patrickk
maybe this helps: http://www.djangoproject.com/documentation/model_api/#blank patrick Am 13.06.2006 um 15:54 schrieb Nagy Károly: > > I have a tree model data and a foreign key is defined with a > null=True. > Generated db table is correct (field is NULL instead of NOT NULL), but > in the adm

Re: Mod_python and Django - AGAIN

2006-06-13 Thread PythonistL
No, it can not be that problem. I use the same models and source on Dreanhost and it works. But now I want to use my Linux box with mod_python and the code does not work. So, any other idea how to solve the problem? Thank you. L --~--~-~--~~~---~--~~ You receiv

Foreignkey problem in admin interface

2006-06-13 Thread Nagy Károly
I have a tree model data and a foreign key is defined with a null=True. Generated db table is correct (field is NULL instead of NOT NULL), but in the admin interface i cannot add an object with empty parent. (With not null parent it works.) And obviously i cannot add first one at all. What was i a

Re: ManyToMany in a custom manipulator?

2006-06-13 Thread mazurin
Hi again, I think I found the answer to my own question, here: http://code.djangoproject.com/wiki/ManipulatorScript I hope this is useful to someone. mikah -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

The only click to add any class

2006-06-13 Thread Grigory Fateyev
Hello! We have compositely app 'Address' with lots of classes. Like: Region, Country, Location and etc. And to fill the only address users need to click some forms to add one address. It's awfully ;( Is it possible to write (Add|Change)Manipulator to commit data from some forms at that time? To

Re: Composite or compound primary key support

2006-06-13 Thread Sanjay
Hi Michael, Nice to get clear answers to my queries. Thanks a lot. Sanjay --~--~-~--~~~---~--~~ 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

ManyToMany in a custom manipulator?

2006-06-13 Thread mazurin
Hi, I'm writing a custom change manipulator for a model. I'm not using the default because there's some special processing that has to happen on each save. Now, this model has a ManyToMany relationship. How do I add a form field that will update that relationship? In effect, it has to work on t

Re: MyFormWrapper.myfield works in {{}} but not {%%} ?

2006-06-13 Thread mazurin
Thanks. I think I figured it out. It's not the expr tag, it's {%%}. It seems that {%%} doesn't cause a form field to render into HTML the way {{}} does. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Composite or compound primary key support

2006-06-13 Thread Michael Radziej
Hi Sanjay, reasons are probably simplicity of code and that it's easy to circumvent when you start with your own fresh database. Django is more targeted to this case, not for legacy systems. Having said this, I use Django for a really ugly old existing database, and it works. There are not so

hello & question (sorting related cmodels)

2006-06-13 Thread Bram de Jong - MTG
Hello everyone, A (long) question: I have two models, linked by a single key. LinkClass ("search engines", ...) and Link ("http://www.google.com";, "http://www.yahoo.com";) Now, in Python I can do: for link_class in LinkClass.objects.all(): print link_class.name for link in link_c

Re: Running two sites off the same Django installation

2006-06-13 Thread David Larlet
2006/6/13, Malcolm Tredinnick <[EMAIL PROTECTED]>: On Tue, 2006-06-13 at 11:21 +0200, David Larlet wrote:>>> 2006/6/13, Malcolm Tredinnick <[EMAIL PROTECTED]>:>> On Tue, 2006-06-13 at 10:39 +0200, David Larlet wrote: > >> >> > 2006/6/13, Ian Holsman <[EMAIL PROTECTED

Guidance would be most welcome

2006-06-13 Thread Paul Childs
I have been using Django for about a month now and I just moved over to the development version. I am creating an application in which the client has dictated very stringent database record management in order to have a detailed audit trail on all changes made data. This does not necessarily mean

Generating models from a class diagram

2006-06-13 Thread Sanjay
It would be very nice to draw a class diagram and get the model code generated for Django. Any tool supporting this? There are some open source tools like argouml and andromda who do this for some ORMs. Reference to any supporting tools, or any kind of inputs on this will help a lot. Thanks Sanj

Create generic views in Django 0.91

2006-06-13 Thread Sam Tran
Hi All, We are working on a service provisioning workflow interface using Django 0.91. We wrote some views that are being used to create/modify/delete manager/subordinates relationships with or without inheritance (Manager can also manage a subordinate's subordinates). We can also visualize the

Re: Composite or compound primary key support

2006-06-13 Thread Sanjay
Thanks a lot for so quick and to the point replies. A few more questions now hit me: 1. Are there any plans in future for supporting composite natural keys? What is the reason behind not supporting this? 2. Is it so that using surrogate primary keys (system generated id) is a better way compared

AutoField that is not a pk?

2006-06-13 Thread Ville Säävuori
Is there some reason why I cannot have an AutoField(primary_key=False) in my model? (In fact, documentation hints that I could, but manage.py gives an assertion error from it.) My pk is a charfield but I would also need an automatically incrementing integer in the same class. Any ideas? --~--~-

Re: Composite or compound primary key support

2006-06-13 Thread Michael Radziej
Sanjay wrote: > Hi All, > > Being new to Django, I am curious to know whether Django supports > composite primary keys. For example, can I have a schema like this: No, it doesn't. Seems this question should go into the FAQ ;-) Michael --~--~-~--~~~---~--~~ You

  1   2   >