Highlight current active page

2008-09-30 Thread Alex Rades
Hi, what kind of pattern do you use to add a class attribute to the current page being viewed? I mean the usual: Home Products FAQ contact us I have this snipped of html defined in the base template and all pages inherit from it. Currently I'm using this templatetag: http://gnuvince.wordpress

Re: How to process 1 form data to another form??

2008-09-30 Thread Malcolm Tredinnick
On Mon, 2008-09-29 at 23:51 -0700, laspal wrote: > Hi, > I have a listing of contact from which I choose contact and get the > mailid. > Now I want to send mail to the selected mailid by using another form. > > So right now what I am doing is : > > view contacts( request): > if request.method

Re: How to process 1 form data to another form??

2008-09-30 Thread Thomas Guettler
laspal schrieb: > So my problem is right now I am sending the mailing_list in the url. > which is not the right way of doing it as I might have more then 100 > mail id in my url. > > So I wanted to know how can I solve this problem??? > Hi, you could sent the IDs as GET parameter: http://...

Re: Using forloop counter to index into a query set

2008-09-30 Thread Malcolm Tredinnick
On Mon, 2008-09-29 at 17:31 -0700, SnappyDjangoUser wrote: > Hi Folks, > > How can I use a forloop counter to index into a query set as in the > example below? > > (I know this code does not work, but I want to do something of the > sort): > > {% for form in quote_product_formset.forms %} >

Re: Admin internationalization

2008-09-30 Thread Alessandro Ronchi
2008/9/30 Malcolm Tredinnick <[EMAIL PROTECTED]>: > > > On Mon, 2008-09-29 at 22:46 -0700, krylatij wrote: >> I have Django site in 2 languages - Moldavian(default) and Russian >> But django-admin is not localized for Moldavian, that's way i want to >> use Russian in admin. >> So my settings.py wil

Re: Admin internationalization

2008-09-30 Thread krylatij
unfortunately i'm not Moldavian-speaker =(( outsourcing =)) So as i understood the only solution is to write middleware, to change locale dynamically --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: How to process 1 form data to another form??

2008-09-30 Thread laspal
>>In other words, why can't you just call it directly as a Python function and >>pass it the list of mail ids you want to send? I tried returning the python function. View contact( request): if request.method == 'POST': return SendMail_Selected(request, new_mailing_list) view Send

Re: How to process 1 form data to another form??

2008-09-30 Thread Malcolm Tredinnick
On Tue, 2008-09-30 at 00:30 -0700, laspal wrote: > > >>In other words, why can't you just call it directly as a Python function > >>and pass it the list of mail ids you want to send? > > I tried returning the python function. I didn't say *return* a Python function. I said *call* a Python fun

Re: Highlight current active page

2008-09-30 Thread David Reynolds
On 30 Sep 2008, at 8:03 am, Alex Rades wrote: > while it's very useful, I don't like it too much, so I'm asking you > what is the best practice here. I tend to do: {% for page in page_list %} {{ page }} {% endfor %} But that obviously requires you to have a list of pages in your co

Custom ModelChoiceField muddle

2008-09-30 Thread Donn
Hi, I have a modelForm that has a foreign key. I want the control to be a link instead of a element. This I have managed. It opens a div which lets me pick a value from a long list. The problem I am having is feeding the chosen value back into the original form. I can't figure out which clean

Re: manyTomany visibility in admin

2008-09-30 Thread urukay
Pavel, so if in tables there is everything ok (all ids match etc), then maybe problem is in browser itself. Or maybe try upgrade to django1.0. Sometimes when i'm looking at e.g. userprofile in Admin interface and i made some changes in templates and then when I only reload Admin view, M2M fields

Re: Highlight current active page

2008-09-30 Thread Steven Armstrong
Alex Rades wrote on 09/30/08 09:03: > Hi, > what kind of pattern do you use to add a class attribute to the > current page being viewed? > I mean the usual: > > > Home > Products > FAQ > contact us > > > I have this snipped of html defined in the base template and all pages > inherit from it.

ManyToMany relationship on self through other table

2008-09-30 Thread chris
Hi there, Just starting to use django, so forgive me if this has been answered before (a quick search at djanog-search did not turn up something useful). What I am trying to do is similar to this (from http://www.djangoproject.com/documentation/models/m2m_recursive/): from django.db import model

Re: Admin internationalization

2008-09-30 Thread krylatij
I use same django instalation for several projects, so it will cause other projects works incorrectly. Any way, thank you for advise --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

image path in CSS - won't work???

2008-09-30 Thread Bobo
Hi everyone, I'm having a very strange problem with my Django project. I’ve a menu with several links but I want to make a hover effect with it and for that I use pictures. The problem is that my path in my CSS won’t work and the pictures aren’t loaded and therefore not shown in the menu. My st

Re: image path in CSS - won't work???

2008-09-30 Thread Kip Parker
A good start is to check you can view http://yoursite.com/site_media/img/menu.jpg directly, if you get an error it will probably point you in the right direction. On Sep 30, 10:13 am, Bobo <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm having a very strange problem with my Django project. I’v

Re: image path in CSS - won't work???

2008-09-30 Thread Erik Allik
You should always use paths relative to the CSS file. Like this: url(../img/menu.jpg) Btw did you try going to that image file from the browser? If you're using the built in development server, you need to set up static file serving. Erik On 30.09.2008, at 12:13, Bobo wrote: > > Hi ever

ManyToMany relation and admin newforms

2008-09-30 Thread Jens
Hello django-users, after searching google and this group and not finding any helpful answers I hope you can help me. I am making an event-app which allows me to manage my own events I organize for me and my friends. I add my friends to the database. Then I create an event and choose which frien

Re: trunk or 1.0?

2008-09-30 Thread chiggsy
> If you can hold off on adopting new features, using v1.0 > will be your safest bet. Thanks. At least i'll be able to have a baseline. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Using mod_python with Lighttpd - advice on the best set up

2008-09-30 Thread Kip Parker
After both your replies and some googling I'm starting to lean towards a FastCGI set up of some sort. The only thing that worries me is dealing with FastCGI crashes, I guess you need a process watcher for each site/FastCGI instance, what's that like to maintain in practice? On Sep 29, 8:53 pm, Pr

Re: Using mod_python with Lighttpd - advice on the best set up

2008-09-30 Thread Graham Dumpleton
On Sep 30, 8:24 pm, Kip Parker <[EMAIL PROTECTED]> wrote: > After both your replies and some googling I'm starting to lean towards > a FastCGI set up of some sort. The only thing that worries me is > dealing with FastCGI crashes, I guess you need a process watcher for > each site/FastCGI instanc

Re: Suggested approach for a date based form layout

2008-09-30 Thread Nick Lo
Hi Gerard, Actually part of my solution was and is using modelform but that was really just for the convenience of save(). I've got a solution together now but thanks for your response, Nick > > Nick, > > I'm not a longtime Django user, but I would check de django docs on > "modelform". Th

Re: ManyToMany relationship on self through other table

2008-09-30 Thread felix
are you actually getting a runtime error or an error when trying to syncdb ? On Sep 30, 10:52 am, chris <[EMAIL PROTECTED]> wrote: > Hi there, > > Just starting to use django, so forgive me if this has been answered > before (a quick search at djanog-search did not turn up something > useful). >

DeprecationWarning: Non-ASCII character in models.py

2008-09-30 Thread Nick
Hi, I've recently noticed that I'm getting the following in my Apache error log... DeprecationWarning: Non-ASCII character '\xc2' in file /var/www/django/ newsite/web/models.py on line 101, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details Line 101 in my models.

Re: DeprecationWarning: Non-ASCII character in models.py

2008-09-30 Thread Graham Dumpleton
Have you read the PEP it refers to? Graham On Sep 30, 9:07 pm, Nick <[EMAIL PROTECTED]> wrote: > Hi, > > I've recently noticed that I'm getting the following in my Apache > error log... > > DeprecationWarning: Non-ASCII character '\xc2' in file /var/www/django/ > newsite/web/models.py on line 10

display of datefield breaks admin template

2008-09-30 Thread Gerard Petersen
Hi all, I'm trying to get my head around why the admin template breaks. I have a properly setup datefield in a product model. When I want to see a product list via the admin gui with the datefield name as part of the list_display declaration like so: class ProductAdmin(admin.ModelAdmin):

Re: Looking for an example on how to use us.forms.USZipCodeField

2008-09-30 Thread Adam Stein
Thanks for the information. I eventually stumbled across a web page that mentioned formfield_for_dbfield(). I wound up doing this: class AddressAdmin(admin.ModelAdmin): def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == "Zipcode": return USZipCodeFi

Re: ManyToMany relationship on self through other table

2008-09-30 Thread chris
On Sep 30, 8:07 pm, felix <[EMAIL PROTECTED]> wrote: > are you actually getting a runtime error or an error when trying to > syncdb ? syncdb works fine, but then I get a runtime error when I want to edit such a record in the admin interface. The traceback complains about the two foreign keys

Re: Highlight current active page

2008-09-30 Thread Gerard Petersen
Hi All, I don't understand why it's needs to be so complicated. When using a 'double' template inheritance, e.g: base > base_products > product_add There's only one place where you have to maintain some navlist html/css code. This is where the 'active' attribute is maintained. So with multiple

Re: Highlight current active page

2008-09-30 Thread Gerard Petersen
Steven, Sorry, I replied to the wrong message in this thread. Your setup is actually quite charming. Regards, Gerard. Steven Armstrong wrote: > Alex Rades wrote on 09/30/08 09:03: >> Hi, >> what kind of pattern do you use to add a class attribute to the >> current page being viewed? >> I mean

Re: DeprecationWarning: Non-ASCII character in models.py

2008-09-30 Thread Jens
I got the same message the other day and the solution was to put following line at the top (first line, befor everything else) of my models.py: #coding: utf8 worked for me, hope it'll work for you. Jens On 30 Sep., 13:07, Nick <[EMAIL PROTECTED]> wrote: > Hi, > > I've recently noticed that I'm

Re: accessing the http conf setting: PythonOption django.root

2008-09-30 Thread felix
ah right, WSGI requests won't have this django_root environ var. so its the completely non-intuitive SCRIPT_NAME (I know, its the server that refers to it as this) this works : {% django_root %} @register.tag def django_root(parser,token): return DjangoRootNode() class DjangoRootNode(tem

Re: Using mod_python with Lighttpd - advice on the best set up

2008-09-30 Thread Erik Allik
Apache can also start/restart your FastCGI process(es) as needed. Erik On 30.09.2008, at 13:33, Graham Dumpleton wrote: > > > > On Sep 30, 8:24 pm, Kip Parker <[EMAIL PROTECTED]> wrote: >> After both your replies and some googling I'm starting to lean >> towards >> a FastCGI set up of some so

Re: Templates, context-setting custom tag and nested blocks - doesn't work ? (and is it supposed to anyway ?)

2008-09-30 Thread bruno desthuilliers
On 29 sep, 23:16, bruno desthuilliers <[EMAIL PROTECTED]> wrote: Partly answering to myself: (snip) > After a couple more tests and investigations, it appears that the > nested blocks have nothing to do with my problem. What really happens > is that, given > > - a context updating tag > - a base

Re: ManyToMany relationship on self through other table

2008-09-30 Thread felix
post the traceback. I may not be able to help you since I haven't tried to do person-to-person at all. it might be simpler to just do Friends and Idols (without using through and without friends and idols being fields on Person) and then add methods to Person that fetch those relationships. or

Re: Date from django to form and back again.

2008-09-30 Thread Peter
fromtimestamp is exactly the ticket. Thanks! On Sep 30, 6:16 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-09-29 at 14:08 -0700, Peter wrote: > > Hi folks, > >   I want to check a form when it submitted to see whether it contains > > an input called 'lastUpdate' > > >   If las

Re: Using mod_python with Lighttpd - advice on the best set up

2008-09-30 Thread Kip Parker
Sounds good, how did you get it to do that? On Sep 30, 1:03 pm, Erik Allik <[EMAIL PROTECTED]> wrote: > Apache can also start/restart your FastCGI process(es) as needed. > > Erik > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

HTTPS Question...

2008-09-30 Thread mccomas . chris
We have an online application for school, where we request the individuals SSN and PharmCAS information. The application will be at say www.oursite.com/application/. Since we're gathering sensitive data, I want to obviously make this secure using https:// I don't want the rest of the site to be on

Re: overwrite get_absolute_url /contrib/auth/User

2008-09-30 Thread felix
and related to this: if your django site needs to be running at someplace besides '/' (say for a beta installation or a subsite) then permalinks and reverse will work correctly, but user.get_absolute_url() will not it will return /user/username/ rather than /subsite/user/username/ so, def _us

Re: HTTPS Question...

2008-09-30 Thread Gerard Petersen
Hi, Using https://application.oursite.com/ would imho be the only simpel solution. An SSL certificate is IP bound, and if you are to serve plain and secure on 1 domain name, you're in for an administrative nightmare. https://www.oursite.com/application/ is possible but then you need to keep t

cannot save model to db

2008-09-30 Thread Manuel Meyer
Hey, I have a model for Thumbnail, but I cannot save it. It says: AttributeError: 'Thumbnail' object has no attribute 'id'. What is wrong? I use django 1.0-final-SVN-unknown thanks, Manuel Here is an example: >>> from portfolio.models import Photo, Thumbnail >>> p = Photo.objects.all()[0]

Translation of object.attribute in template

2008-09-30 Thread Gerard Petersen
Hi all, I've been trying to workout a solution on the following: I want to show the translation of a string stored in the database in a template preferably with the use of "|capfirst" .. yeah yeah I know .. ;-) The translatable: order.state = 'billed' .. The term 'billed' is what needs to be

Re: Translation of object.attribute in template

2008-09-30 Thread Kenneth Gonsalves
On Tuesday 30 September 2008 10:40:15 am Gerard Petersen wrote: > #~ msgid "quoted" > #~ msgstr "jaja" > > It's in the template like this "{% trans order.state %}" so it's not picked > up by the makemessages command. Then another option is putting the > translation in the view, and manipulate it t

Re: DeprecationWarning: Non-ASCII character in models.py

2008-09-30 Thread Sérgio Durand
Hi Nick, Insert the following code as first line of your models.py (and other .py files) # -*- coding: utf-8 -*- []'s Sergio Durand Nick escreveu: > Hi, > > I've recently noticed that I'm getting the following in my Apache > error log... > > DeprecationWarning: Non-ASCII character '\xc2' in f

Re: HTTPS Question...

2008-09-30 Thread Jeff Anderson
[EMAIL PROTECTED] wrote: > We have an online application for school, where we request the > individuals SSN and PharmCAS information. The application will be at > say www.oursite.com/application/. Since we're gathering sensitive > data, I want to obviously make this secure using https:// I don't wa

Re: Templates, context-setting custom tag and nested blocks - doesn't work ? (and is it supposed to anyway ?)

2008-09-30 Thread bruno desthuilliers
On 30 sep, 14:04, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 29 sep, 23:16, bruno desthuilliers <[EMAIL PROTECTED]> > wrote: > > Partly answering to myself: > > (snip) > > > After a couple more tests and investigations, it appears that the > > nested blocks have nothing to do with my prob

Dynamically appending a step to FormWizard

2008-09-30 Thread Jeroen
Hi All, I'm adding a step to FormWizard based on user input from the previous (first) step: def process_step(self, request, form, step): if step == 0: self.form_list.append(get_form2(form.cleaned_data['mode'])) Above works, a second (and final) form is created based on the value of

Re: DeprecationWarning: Non-ASCII character in models.py

2008-09-30 Thread Scott Moonen
An alternative solution is to replace the pound character with the HTML entity £. -- Scott On Tue, Sep 30, 2008 at 8:01 AM, Jens <[EMAIL PROTECTED]> wrote: > > I got the same message the other day and the solution was to put > following line at the top (first line, befor everything else) of my

Re: Custom ModelChoiceField muddle

2008-09-30 Thread Donn
Perhaps if I ask it in a different way: 1. A 'book' has a title (string) and an author (foreign key). 2. I use a ModelForm from the model. 3. I want the 'author' form-control to look like this: Author:__ [click here to choose or add an author] 4. When you click the link it opens a div. 5. The

Re: Using forloop counter to index into a query set

2008-09-30 Thread SnappyDjangoUser
Hi Malcolm, You suggested: > set up the data structures > you pass to your view a bit differently so that you can loop over the > forms and the products simultaneously (that is, pull apart the formset > forms and zip them together with the product entries in the view). This is exactly what I li

relating auth user to company model

2008-09-30 Thread MilesTogoe
> On Sep 29, 12:58 am, MilesTogoe <[EMAIL PROTECTED]> wrote: > >> I've seen the docs on how to relate the user with a 1-1 relationship (ie >> profile) but is there a way to have another model relate in a 1:many >> (ie one company with many users) - this would require user to have a >> company f

Re: How to view the sql query statement involved in a django web page?

2008-09-30 Thread pihentagy
That's fine, and useful indeed, but I need a bit more detail: I'm hunting for duplicate queries. Is there a possibility to tell where django fires those queries? thanks On Aug 29, 6:38 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > How to view thesqlquerystatement involved in a django web page for

Re: display of datefield breaks admin template

2008-09-30 Thread Carl Meyer
On Sep 30, 7:29 am, Gerard Petersen <[EMAIL PROTECTED]> wrote: > I get this trace:http://paste.pocoo.org/show/86579/ > > This is the model in question:http://paste.pocoo.org/show/86580/ Remove the strftime() call from your default= setting for the DateField. Django model fields automatically han

Re: Using forloop counter to index into a query set

2008-09-30 Thread Carl Meyer
On Sep 30, 11:05 am, SnappyDjangoUser <[EMAIL PROTECTED]> wrote: > > set up the data structures > > you pass to your view a bit differently so that you can loop over the > > forms and the products simultaneously (that is, pull apart the formset > > forms and zip them together with the product entr

Re: Using forloop counter to index into a query set

2008-09-30 Thread felix
malcom is suggesting this: def view(request): blah blah blah ... zipped = [] for p in products: v = find the vendor for this product zipped.append( ( p, v) ) # add them as a tuple # or more pythonically if its easy to find your vendor: zipped = [ (p, vendor for

Django JSON deserialization and caching

2008-09-30 Thread [EMAIL PROTECTED]
Hi guys, I was wondering if somebody could help me with deserialization. I'm currently trying to cache the result of a database query using a JSON serializer in (what I assume to be) the standard fashion: --- def cache_query(id): cache_key = "cache_key_" % id item = cache.get(ca

Re: per-request cache

2008-09-30 Thread pihentagy
Hi! Thanks for your reply. I thought about it, and come up with the following comments: On Sep 15, 11:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 15, 9:11 am, pihentagy <[EMAIL PROTECTED]> wrote: > > Also for consistency and for performance reasons, is it possible to > > someh

Re: Django JSON deserialization and caching

2008-09-30 Thread Rajesh Dhawan
On Sep 30, 12:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi guys, > > I was wondering if somebody could help me with deserialization. > > I'm currently trying to cache the result of a database query using a > JSON serializer in (what I assume to be) the standard fashion: > > ---

Many to Many where two fields in one model are related

2008-09-30 Thread Steve Bergman
I had trouble coming up with a decriptive "subject" for this. Sorry. I'm working on an app for planning balanced daily diets. And I'm having trouble figuring out how to set up my models. I have: Ingredient(models.Model): ingredient_name = CharField(max_length=50) unit = CharField(max_

Re: egregiously long model names, hashes, constraints

2008-09-30 Thread felix
whoops, you are right. those weren't the same tables. two with the exact same tables are posted in the ticket: http://code.djangoproject.com/ticket/9253 On Sep 30, 3:23 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Please open a new ticket about this. Looks like there is an assumption

Re: Many to Many where two fields in one model are related

2008-09-30 Thread Rajesh Dhawan
> I'm working on an app for planning balanced daily diets. And I'm > having trouble figuring out how to set up my models. I have: > > Ingredient(models.Model): > ingredient_name = CharField(max_length=50) > unit = CharField(max_length=15) > calories = DecimalField(max_digits=6, deci

Re: Django JSON deserialization and caching

2008-09-30 Thread [EMAIL PROTECTED]
Hi Rajesh, Thanks for your help so far - that definitely improved things somewhat! However, I'm still having a slight problem. When I pass Item.objects.get(id=id) into the serializers.serialize( ... ) function, it tells me that the Item is not iterable (this is why I was originally using filter(

Re: cannot save model to db

2008-09-30 Thread Rajesh Dhawan
> I have a model for Thumbnail, but I cannot save it. It says: > AttributeError: 'Thumbnail' object has no attribute 'id'. > What is wrong? > > I use django 1.0-final-SVN-unknown > > thanks, Manuel > > Here is an example: > > >>> from portfolio.models import Photo, Thumbnail > >>> p = Photo.obj

Re: Django JSON deserialization and caching

2008-09-30 Thread Rajesh Dhawan
> Thanks for your help so far - that definitely improved things > somewhat! Great. > > However, I'm still having a slight problem. When I pass > Item.objects.get(id=id) into the serializers.serialize( ... ) > function, it tells me that the Item is not iterable (this is why I was > originally usi

cannot import name execute_manager

2008-09-30 Thread KillaBee
I am use the svn and I just installed it last night, but it is giveing me this error: [EMAIL PROTECTED]:/home/bryant/Django-1.0/intranet# python manage.py runserver 8080 Traceback (most recent call last): File "manage.py", line 2, in from django.core.management import execute_manager Impor

Re: HTTPS Question...

2008-09-30 Thread Rajesh Dhawan
On Sep 30, 9:28 am, [EMAIL PROTECTED] wrote: > We have an online application for school, where we request the > individuals SSN and PharmCAS information. The application will be at > saywww.oursite.com/application/. Since we're gathering sensitive > data, I want to obviously make this secure usi

Re: cannot import name execute_manager

2008-09-30 Thread Rajesh Dhawan
KillaBee wrote: > I am use the svn and I just installed it last night, but it is giveing > me this error: > > [EMAIL PROTECTED]:/home/bryant/Django-1.0/intranet# python manage.py runserver > 8080 > Traceback (most recent call last): > File "manage.py", line 2, in > from django.core.manage

Re: display of datefield breaks admin template

2008-09-30 Thread Gerard Petersen
Carl, That did the trick. It does, however, leave me with a previous problem. When I edit the object via a form (in my app) it displays the field value like this "2008-09-30". And due to field validation the form widget only accepts this format: "30-09-2008". Any clue on how a datefield cont

Re: status of per-object-level permission

2008-09-30 Thread kajigga
> It seems to me that lot of developers are opting for auth backend - > doing things outside Django. I was looking into phpGACL then I > foundhttp://code.google.com/p/spiff-guard/which is a sort of a similar > project in python. > Have you had any success in using spiff guard with django? I hav

SlugField & prepopulate_from

2008-09-30 Thread lingrlongr
Before the new forms and admin came, I could've sworn that the prepopulate_from (now prepopulated_fields) stuff worked when creating a new object in the admin, __AND__ when you edit an existing object. Can someone confirm if this should work for editing objects too? Currently, it does not. Keith

Re: Translation of object.attribute in template

2008-09-30 Thread Gerard Petersen
Kenneth, It is indeed stored, I'm using a state machine (http://www.djangosnippets.org/snippets/737/). Setting this up multilingual could result in unusable orders states, when users change their locale during the state/transition of an order. The tricky thing is that the states (used for con

Re: cannot import name execute_manager

2008-09-30 Thread KillaBee
On Sep 30, 1:27 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > KillaBee wrote: > > I am use the svn and I just installed it last night, but it is giveing > > me this error: > > > [EMAIL PROTECTED]:/home/bryant/Django-1.0/intranet# python manage.py > > runserver > > 8080 > > Traceback (most rece

Re: Translation of object.attribute in template

2008-09-30 Thread Carl Meyer
On Sep 30, 2:58 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > It is indeed stored, I'm using a state machine > (http://www.djangosnippets.org/snippets/737/). Setting this up multilingual > could result in unusable orders states, when users change their locale during > the state/transition of

IntegrityError in admin with django-tagging

2008-09-30 Thread smcoll
i'm trying to get a TagField working in the admin for my model using django-tagging 0.2. i get an IntegrityError when i save my model from the admin- it looks like django is trying to send a python list to the database, where string is expected. i suspect i haven't set it up right. Can someone

Re: ModelForm and request.POST

2008-09-30 Thread globophobe
Doh, I changed the prefix of my form. I get it now. Thank you Malcolm. --~--~-~--~~~---~--~~ 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 unsub

Re: Set referer header in test client?

2008-09-30 Thread Tim Sawyer
On Tuesday 30 Sep 2008, Russell Keith-Magee wrote: > > Can I simulate this header with the test client? > > Yes. > > The full method signature for client.post() is: > def post(self, path, data={}, content_type=MULTIPART_CONTENT, **extra): > > 'extra' is an argument that allows you to specify a

Re: Translation of object.attribute in template

2008-09-30 Thread Gerard Petersen
Carl, You lost me. You mean make the states numerical and in the array related its (numeric) keys to the, then translatable, 'words'? If so, the problem would be that the ease of use in coding would stop to exist. The statemachine dynamically creates methods so you can use stuff like order.bi

mptt + contrib.comments?

2008-09-30 Thread Chris Stromberger
I'm trying to use mptt with contrib.commments and am not having much luck. Basically would like to allow nested comments. Pretty new to Django, so that is contributing to the problem. Would love to see a simple example/summary of what needs to change in contrib.comments to incorporate mptt. Than

Re: Django JSON deserialization and caching

2008-09-30 Thread [EMAIL PROTECTED]
Hi Rajesh, That worked brilliantly...the number of queries has been massively reduced now that I've taken your suggestion to eliminate the serialization. Thanks a lot for that! Very much appreciated. Kind regards, Mike. On Sep 30, 6:45 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > Thanks f

Re: display of datefield breaks admin template

2008-09-30 Thread Carl Meyer
On Sep 30, 2:19 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > That did the trick. It does, however, leave me with a previous problem. When > I edit the object via a form (in my app) it displays the field value like > this "2008-09-30". And due to field validation the form widget only accepts

Re: Using forloop counter to index into a query set

2008-09-30 Thread SnappyDjangoUser
This is extremely helpful! I didn't know this was possible in Django to create a tuple and loop through both items using a for loop in the template. Thank you! I am currently hung up on one last part, however. In the example above you assume that both p and v belong to products. In my case, t

Re: Translation of object.attribute in template

2008-09-30 Thread Carl Meyer
On Sep 30, 3:29 pm, Gerard Petersen <[EMAIL PROTECTED]> wrote: > You lost me. You mean make the states numerical and in the array related its > (numeric) keys to the, then translatable, 'words'? > > If so, the problem would be that the ease of use in coding would stop to > exist. The statemachin

Re: Translation of object.attribute in template

2008-09-30 Thread Gerard Petersen
Carl, You can hold the brain on this one. I think I found out a solution. Probably similar to yours except using the states as keys. i18nstates = { 'created': _('Created'), 'quoted': _('Quoted'), 'cancelled': _('Cancelled'), 'ordered': _('Ordered'), 'bill

Extra select question

2008-09-30 Thread krylatij
I have model with 3 fields - id, name_ru, name_en I want rename 'name_ru' field to 'name' in query i try this: operations = OperationType.objects.values('id').extra(select={'name': 'name_ru'}) but it returns only 'id' what's wrong?? --~--~-~--~~~---~--~~ You

Re: status of per-object-level permission

2008-09-30 Thread Roman Chyla
I am planning to use it together with django - but not for the django site, as a general permission system for digital documents. Using spiff-guard for the backend, and django as an interface to set up the rules. But I haven't really started putting them together, maybe you have clearer ideas abou

Re: mptt + contrib.comments?

2008-09-30 Thread Chris Stromberger
One specific issue I am having is that the admin screen for the Comment model is not "synched up" with the data. The admin list screen has a table of field names, and the columns do not match the data--the data is shifted. So for example, the "Is public" column is displaying the IP address. Etc.

Re: mptt + contrib.comments?

2008-09-30 Thread Chris Stromberger
OK, nevermind on the admin page issue. Was being caused by TEMPLATE_STRING_IF_INVALID being set to something other than ''. Would still love to see an example of contrib.comments + mptt! Thanks, Chris On Tue, Sep 30, 2008 at 4:25 PM, Chris Stromberger < [EMAIL PROTECTED]> wrote: > One specific

Re: unexpected keyword argument 'force_insert'

2008-09-30 Thread akhaitan
Thanks a lot.. i had similar problems.. Did helped.. On Sep 24, 1:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Found it... actually on the user_profile models save() > > changing it to > def save(self, *args, **kwargs): > ... >    super(SiteUser, self).save(*args, **kwargs) > > fixed i

How to dynamically set choices in ChoiceField

2008-09-30 Thread alan
I'm having trouble dynamically assigning the choices to a ChoiceField. My ChoiceField stores an object's state. In the template pulldown for this field, I want to restrict the user to only go from stateA to StateB; from stateB to stateC, etc. Hence the allowable choices need to be a set based o

Re: status of per-object-level permission

2008-09-30 Thread kajigga
I'm not sure exactly how to proceed myself. I am very pleased with Django in general, but not having ready to use object-level permissions is driving me nuts. I realize that django was designed with a slightly different view point, but there must be something out there to make it easier. Anyway

question about return value when selecting next id from postgresql using nextval

2008-09-30 Thread Merrick
If I run the following query on psql: SELECT nextval('redirect_link_id_seq'); it returns an integer, say 5 when I do the following with the django shell I get a different result: >>> def get_next_id(): ... cursor = connection.cursor() ... cursor.execute("SELECT nextval('redirect_link_i

Re: status of per-object-level permission

2008-09-30 Thread James Bennett
On Tue, Sep 30, 2008 at 5:07 PM, kajigga <[EMAIL PROTECTED]> wrote: > I've just come across this Django branch called "RowLevelPermission". > http://code.djangoproject.com/wiki/RowLevelPermissions. I have yet to > try it out. Don't bother; it's dead as a doornail and has been for quite a long ti

Re: Using forloop counter to index into a query set

2008-09-30 Thread felix
On Sep 30, 9:36 pm, SnappyDjangoUser <[EMAIL PROTECTED]> wrote: >  In the example > above you assume that both p and v belong to products.   I just put them into a combined array called "products" > In my case, > that is not the case.  I have a queryset of products that contains the > vendor

Re: Many to Many where two fields in one model are related

2008-09-30 Thread Steve Bergman
Thank you. That looks to be exactly what I need. I remember seeing that on the ToDo list leading up to 1.0, but didn't realize how it applied to my situation. -Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Using forloop counter to index into a query set

2008-09-30 Thread SnappyDjangoUser
Malcolm, Carl and Felix, Thanks for the help! I figured out a solution to my above problem by using the suggested for loop approach to build the tuple of products and forms. It may not be the most elegant python code, but it is working and readable. # Build a tuple of products and forms for ea

Re: status of per-object-level permission

2008-09-30 Thread kajigga
Thanks for the tip. I hadn't had time to check on the commits or status of the project yet. Others have mentioned a "variety of options" out there. I guess I haven't looked hard enough yet, because I'm not seeing them. Do you have any suggestions? - kajigga On Sep 30, 4:10 pm, "James Bennett

Re: How to dynamically set choices in ChoiceField

2008-09-30 Thread eswenson
I just ran into this myself, yesterday and found the solution by perusing the django source code. Your form class (MyClass) will have had a field called "fields" created by the meta class of the base form. That field will have a choices field that you can set. In your setChoice method (which, by

Re: accessing the http conf setting: PythonOption django.root

2008-09-30 Thread Graham Dumpleton
FWIW, SCRIPT_NAME derives from CGI standard, so, it isn't like Django arbitrarily chose it. Graham On Sep 30, 10:03 pm, felix <[EMAIL PROTECTED]> wrote: > ah right, WSGI requests won't have this django_root environ var. > > so its the completely non-intuitive SCRIPT_NAME > (I know, its the serve

How to invoke a request to an URL inside a web app without making a real request?

2008-09-30 Thread maverick
Hi, I have a django web application, I want to invoke a request of one URL inside this application, e.g. "/getdata/", and capture the output of such URL and do some further processing. Of course I can do that by make a real request, however I feel this may not be the best solution, is there any

Re: How to invoke a request to an URL inside a web app without making a real request?

2008-09-30 Thread Keith Eberle
sure can! take a look @ http://docs.python.org/lib/module-urllib.html keith On Tue, Sep 30, 2008 at 8:00 PM, maverick <[EMAIL PROTECTED]> wrote: > > Hi, I have a django web application, I want to invoke a request of one > URL inside this application, e.g. "/getdata/", and capture the output >

  1   2   >