Re: how to add a field to a model form when the field is not in the model

2010-04-06 Thread Daniel Roseman
On Apr 7, 4:05 am, Merrick wrote: > I added a checkbox form field to my template, and I even tried to add > it in my forms.py and then in my views.py I check for it like so: > > if form.cleaned_data['checkbox_field']: >   code to send email... > > But when I submit the form I get a KeyError. How s

Re: how to add a field to a model form when the field is not in the model

2010-04-06 Thread raj
On Apr 7, 8:05 am, Merrick wrote: > How should I go about adding a field to a model form > when the field is not part of the model? Define a Custom ModelForm by specifying model in Meta and declare the required addnl field there. (check-box means boolean, right?). Now set form attribute of your

Re: url template tag taking a long time

2010-04-06 Thread Russell Keith-Magee
On Wed, Apr 7, 2010 at 12:08 PM, Brian Neal wrote: > I am on trunk, somewhere around revision 127xx and just updated to > 12936. A couple of my views render this one particular template, which > used to take less than a second to see a response. Now it is taking > almost a minute. The Django debug

url template tag taking a long time

2010-04-06 Thread Brian Neal
I am on trunk, somewhere around revision 127xx and just updated to 12936. A couple of my views render this one particular template, which used to take less than a second to see a response. Now it is taking almost a minute. The Django debug toolbar reports nothing out of the ordinary in terms of SQL

Re: Tagging - Extending by adding a rating?

2010-04-06 Thread Victor Hooi
heya, Hmm, I haven't thought about that. From what I can gather, the "TaggedItem" model is what links "Tag" to your own model, via Generic Relations - so it's basically the glue that binds the two. I think adding another intermediary table between your model and "TaggedItem" might break all the T

Re: Formatting datetimes - simple question

2010-04-06 Thread Brian Neal
On Apr 6, 5:29 pm, Paweł Roman wrote: > Hi all, > > Django has this DATETIME_FORMAT setting, which allows to format all > datetime values, whenever they are displayed. But the problem is this > is a _global_ setting, so whoever uses the application would see all > the datetimes formatted exactly t

how to add a field to a model form when the field is not in the model

2010-04-06 Thread Merrick
I added a checkbox form field to my template, and I even tried to add it in my forms.py and then in my views.py I check for it like so: if form.cleaned_data['checkbox_field']: code to send email... But when I submit the form I get a KeyError. How should I go about adding a field to a model form

Re: Newbie: New user creation with forms

2010-04-06 Thread Wiiboy
What exactly do you mean by, "Create a user and allow that user to submit data such as messages"? -- 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...@googlegroups.com. To unsubscribe from this group,

Newbie: New user creation with forms

2010-04-06 Thread NicMAN
Hi all i'm a beginner at django and was wondering if any one can help me by being able to create a user and to allow that user to submit data such as messages onto my website! I'm struggling with learning the hard stuff in django. Thanks in advance -- You received this message because you are su

Re: queryset in clean method

2010-04-06 Thread Vinicius Mendes
You can pass the competition instance to the for in the initialization. In the form you change the form a little bit adding the init method to receive the competition parameter. Then you can save it in a form attribute and then use it in clean method. I made a simple gist to show you haw it could

Re: Formatting datetimes - simple question

2010-04-06 Thread ShawnMilo
In your forms and modelforms, you can specify both the allowed input date formats and the display format. http://docs.djangoproject.com/en/1.1/ref/forms/fields/#datefield (see the input_format option) http://docs.djangoproject.com/en/1.1/ref/forms/widgets/ (see the 'format' option) As for col

Formatting datetimes - simple question

2010-04-06 Thread Paweł Roman
Hi all, Django has this DATETIME_FORMAT setting, which allows to format all datetime values, whenever they are displayed. But the problem is this is a _global_ setting, so whoever uses the application would see all the datetimes formatted exactly the same way. I'd like to allow individual users to

Re: inner join operation on legacy tables?

2010-04-06 Thread jani.mono...@gmail.com
I have eventually made a MySQL view combining the two tables and then used a simple Django queryset on it, but I'd still be curios if there's a Django way of addressing this and similar issues. On Apr 6, 9:26 pm, "jani.mono...@gmail.com" wrote: > > The generated model from inspectdb is only a bes

queryset in clean method

2010-04-06 Thread When ideas fail
hello, i have a clean method in my forms.py. I want this to check a person is old enough to enter a competiton The problem i have is that the minimum age changes and is a field in the competition model(it is entered by the user). My clean method is like this (pseudo code): class personform(forms

Re: pure Django master/detail forms?

2010-04-06 Thread Cesar Devera
it seems that inline-formsets will do the job. something related to models.BaseInlineFormSet and models.inlineformset_factory. http://code.google.com/p/django-dynamic-formset/ I'm still studying the code. :P regards. - On 6 abr, 16:09, Cesar Devera wrote: > hi. imagine following scena

pure Django master/detail forms?

2010-04-06 Thread Cesar Devera
hi. imagine following scenario: #-- from django.db import models from django.forms.models import ModelForm # ignore this Sample for now. focus on Master and Detail class Sample(models.Model): foo = CharField() class Master(models.Mo

Re: Newbie question regarding User and Anonymous user

2010-04-06 Thread zenr
In my case, I store the instance of the User class along with some other information. If the user is logged in, I used request.user to get the instance and store it. The problem happens when the user is Anonymous. I finally fixed the problem by checking if the user is authenticated and setting the

Re: inner join operation on legacy tables?

2010-04-06 Thread jani.mono...@gmail.com
> The generated model from inspectdb is only a best guess, but there's > nothing to stop you editing it. If your field really is a foreign key, Not really a foreign key,both tables have a string field ID which is the same, and unique in one table. So it could be a foreign key except it is not expl

Re: django-paypal

2010-04-06 Thread Matthias Kestenholz
On Tue, Apr 6, 2010 at 8:12 PM, Ramdas S wrote: > > Hey Thanks! > > Should I exempt all the views > I don't know django-paypal that well, but you should only exempt those which are supposed to receive POST requests from external domains (paypal) and which are secured against CSRF attacks in some

Re: django-paypal

2010-04-06 Thread Ramdas S
Hey Thanks! Should I exempt all the views On Apr 6, 11:10 pm, Matthias Kestenholz wrote: > On Tue, Apr 6, 2010 at 8:05 PM, Ramdas S wrote: > > Hi, > > > I am trying to use using django-paypal. Everything works fine, expect that > > the IPN doesn't reach the site. > > > I followed the code a pe

Re: django-paypal

2010-04-06 Thread Matthias Kestenholz
On Tue, Apr 6, 2010 at 8:05 PM, Ramdas S wrote: > Hi, > > I am trying to use using django-paypal. Everything works fine, expect that > the IPN doesn't reach the site. > > I followed the code a per instructions in the > http://github.com/johnboxall/django-paypal > > I am able to send and receive mo

django-paypal

2010-04-06 Thread Ramdas S
Hi, I am trying to use using django-paypal. Everything works fine, expect that the IPN doesn't reach the site. I followed the code a per instructions in the http://github.com/johnboxall/django-paypal I am able to send and receive money. But without IPN the goods which is primarily information se

multisite url reverse using subdomains

2010-04-06 Thread Matías Iturburu
I have a similar question than [django cross-site reverse][1]. But i think I can't apply the same solution. I'm creating an app that lets the users create their own site. After completing the signup form the user should be redirected to his site's new post form. Something along this lines:

Re: inner join operation on legacy tables?

2010-04-06 Thread Daniel Roseman
On Apr 6, 5:26 pm, Jani Monoses wrote: > Hello, > > what is the most straightforward way of making an implicit joining of > two tables in the Django development version? > > The tables are created by another application and are only read in > Django, and while they have a field that they can be jo

inner join operation on legacy tables?

2010-04-06 Thread Jani Monoses
Hello, what is the most straightforward way of making an implicit joining of two tables in the Django development version? The tables are created by another application and are only read in Django, and while they have a field that they can be joined on (a string) that is not explicit in the

Custom QuerySet method that has an instance.save() error

2010-04-06 Thread Tom M
Hi, I'm trying to use Model Managers to write some per model functionality. I have a Book model that needs to be able to convert some of it's members into SoldBook items. I want to be able to do: Book.objects.filter(supplier='Jones').convert_sold() I'm basing my code on http://stackoverflow.com

Re: Problems with model with optional FileField in Admin

2010-04-06 Thread Marcos Marín
Yes, sorry for not mentioning it. On Tue, Apr 6, 2010 at 08:12, Walt wrote: > Did you also specify null=True? > > > Walt > > -~ > > -- > 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...@googlegro

Re: Problem with admin actions and i18n

2010-04-06 Thread Vinicius Mendes
Sorry, i am using Django 1.1.1 final >>> import django >>> django.VERSION (1, 1, 1, 'final', 0) __ Vinícius Mendes Solucione Sistemas http://solucione.info/ On Tue, Apr 6, 2010 at 1:09 PM, Ramiro Morales wrote: > On Tue, Apr 6, 2010 at 12:48 PM, Vinicius Mendes > wrote: >

Re: Problem with admin actions and i18n

2010-04-06 Thread Ramiro Morales
On Tue, Apr 6, 2010 at 12:48 PM, Vinicius Mendes wrote: > Hi, > I have a ModelAdmin with two new actions and I added a > locale/pt_BR/LC_MESSAGES to my project folder to change the translation of > the "Delete selected" option. Locally it works but the translated message > user is the provided by

Problem with admin actions and i18n

2010-04-06 Thread Vinicius Mendes
Hi, I have a ModelAdmin with two new actions and I added a locale/pt_BR/LC_MESSAGES to my project folder to change the translation of the "Delete selected" option. Locally it works but the translated message user is the provided by Django. I get my change list with 3 actions, but when I run it in

Building a financial app with Django

2010-04-06 Thread mf
Hi guys, I'm building an app for a small business so I've to work with currencies, decimal numbers, etc... My goal is to create something like pulseapp.com. I've searched for opensource projects to look and the only thing I had found was django-cashflow. This app uses python-money. I've read some

Get the value of a bound field in admin

2010-04-06 Thread filias
Hi, how can I get the value of a bound field in django admin? I am extending some functionalities in the admin and I would like to be able to show something according to the field value. I want to do this in the change_form.html or fieldset.html files, so in the template. How can I get access to

Re: TemplateSyntaxError in the admin pages

2010-04-06 Thread Karen Tracey
On Tue, Apr 6, 2010 at 2:17 AM, Martin Lundberg wrote: > Ah, great! Do you know the ticket or changeset for it? Curious to peek and > learn a little :) > http://code.djangoproject.com/ticket/11461 Karen -- You received this message because you are subscribed to the Google Groups "Django users

Re: Newbie question regarding User and Anonymous user

2010-04-06 Thread Karen Tracey
On Mon, Apr 5, 2010 at 3:32 PM, zenr wrote: > In my application, I used django-registration to allow users to > login. Authenticated users can use all features of the site while > Anonymous user should be able to use some portion of the site. When > django makes a request for an authenticated us

Re: Problems with model with optional FileField in Admin

2010-04-06 Thread Walt
Did you also specify null=True? Walt -~ -- 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...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.c

Re: Middlewares disable for specific views

2010-04-06 Thread Tim Shaffer
It's actually the auth context processor that queries for messages, not the auth middleware. The TEMPLATE_CONTEXT_PROCESSORS are only processed when you using RequestContext. So there are numerous ways to get prevent the auth context processor from being used. You could just not use RequestContext

Re: How to concatenate a list of Q objects?

2010-04-06 Thread Vinicius Mendes
I recommend you to read more documentation about python. It's a basic python feature. You can read more about it here: http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/ Try this: Sample.objects.filter(*qObjects) __ Vinícius Mendes Solucione Sistema

Middlewares disable for specific views

2010-04-06 Thread Thierry
Is it possible to disable a middleware such as the authentication one for specific views where they are not needed? The constant querying for messages annoys me a bit :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Hosting for Django sites

2010-04-06 Thread Subramanyam
Hi Did you use memcache in deployment in the shared plans Regards Subramanyam On Sun, Apr 4, 2010 at 9:54 PM, Justin Myers wrote: > I'm a fan of Webfaction's shared plans, and I've used them for three > or four projects now. I've had no problems with their support, and > they even did a prett

Re: search and filtering in app engine

2010-04-06 Thread knight
Thanks. On Apr 2, 4:22 pm, Waldemar Kornewald wrote: > On Apr 2, 12:26 pm, knight wrote: > > > 1.) I get error: "'Query' object has no attribute 'all'" on line 59 in > > views. > > As I understand it's something to do with the fact that GAE queryset > > is different from django queryset. > > How

LFS - weird behaviour on image creation

2010-04-06 Thread Simone Orsi
Hi *, anybody has faced this? http://groups.google.de/group/lightning-fast-shop/browse_thread/thread/73cc6a8ec3fa330 TIA, SimO -- 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...@googlegroups.com.

Re: Mod_python error: AttributeError: 'str' object has no attribute 'status_code'

2010-04-06 Thread bruno desthuilliers
On 5 avr, 21:49, Nihaar Gupta wrote: > Help. I'm a bit of an apache/mod_python noob and am not sure what is > causing this error. I get this at page load every so often (not all > the time). Sometimes the page loads fine and sometimes it throws this > exception. > > Guessing from the fact that th