I'd start by looking at the HTML that results, particularly the "input name"
parts. From your symptoms, it sounds like you may have two (or more) with the
same name.
Chris
> -Original Message-
> From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of Tim
> Sent: 22
> class CustomForm( forms.Form):
> age = forms.ChoiceField(label='Age', choices=AGE_CHOICES)
>
> How can I get the value (not the key) of the age attribute after
> validation?
>
> if f.is_valid():
> cd = f.cleaned_data
>
> cd['age'] # returns the "key", not the value
Once you've saved th
Gonzalo Delgado wrote:
>
> The question is: why doesn't something like this work:
>
> ticketform.fields['server'].queryset =
> Server.objects.filter(users=request.user)
> ?
> It doesn't end up on any error, but the rendered form doesn't filter out the
> server choices.. any clue?
>
>
msoulier wrote:
> I am using Django stable (0.96).
>
> When I use form_for_model on a model that includes CharFields that
> have choices attributes, the resulting form field is not a ChoiceField
> as specified in the documentation. Is this simply a bug in 0.96?
>
>
I think it's this one :
http:
staff-gmail wrote:
> I'm using vers .96
> I converted a char field to have choices
>
> old: prefix = models.CharField(maxlength=100, default = 'Mr.')
>
> I then changed my model:
> SALUTATION=(
> ('Mr.','Mr.'),
> ('Ms.','Ms.'),
> )
> ...
> prefix = models.CharField(maxlength=100, choices=SALUT
Chris Brand wrote:
> staff-gmail wrote:
>> Where is "choice_set" coming from ??
> That one's easy -
> http://www.djangoproject.com/documentation/db-api/#backward
>
> Chris
>
Oh, and the explanation for it's use in a template is at
http://www.djangopr
staff-gmail wrote:
> Where is "choice_set" coming from ??
That one's easy -
http://www.djangoproject.com/documentation/db-api/#backward
Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
This behaviour seems odd. Am I doing something wrong, or have I hit a bug ?
I'm expecting that changing the choices of f shouldn't affect f2.
I'm using 0.96.
class MyForm(forms.Form):
x = forms.MultipleChoiceField()
> f = MyForm()
> f2 = MyForm()
> f2.as_p()
u'X: \n
> f.choices = [('1','
kidormb wrote:
> When I restart Apache2 and invoke an application in mysite, the
> response is correct. If I then
> invoke an application in testsite, there are errors with the url since
> it is apparently still using the
> mysite settings.
>
> I have to restart Apache2 to correctly invoke an app
Justin Lilly wrote:
> Actually there is a reason why debian based OS's are preferred (in my
> opinion). Having installed Django on CentOS, I found that you have to
> run two concurrent versions of python. One for the OS and its tools
> and one to run django on. (I believe I had to run 2.3 and 2
dbee wrote:
>When the reminders_list in the 'if' statement below gets assigned,
>there doesn't seem to be a problem. But when I reference it at the
>bottom of the code segment. I end up with the programming error at the
>bottom of the page.
>
>
Do you know which line triggers the error ? It's n
dbee wrote:
>Hmm, I'm not entirely sure where you got the campaign.groups_set
>construction there James. There is no campaign.groups_set afaik ...
>
>
>
Probably from here :
http://djangoproject.com/documentation/db-api/#related-objects
Did you try it or just assume that James made a mistake ?
Hi Peter,
> What should I pass as a dummy queryset parameter: this is positional
> mandatory argument and I cannot pass None.
If you're going to replace it before you render the form, it really doesn't
matter - any queryset will do.
I used .objects.all(), but that has the disadvantage of actua
> def my_view(request):
>
> class MyForm(forms.Form)
> emails = forms.ModelMultipleChoiceField(queryset=
> MyDBModel.objects.filter(user=request.user.id)
>
>
> But I'd like to have form declaration out of this view na pass user's
> ID as an argument - is there any way
> You can specify it upon form creation. Here is an example of how you
> could use prefixes for multiple model forms:
Thanks, Nathan.
That's very useful.
Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Dj
> Maybe the problem is with the depth parameter, but since I have a self
> reference in the offer model, I have to use depth parameter. I have
> increased the depth prameter, but I get the same error.
Sounds like it could be bug 4789, which I recently tripped over myself.
Can you increase the dep
> - When you instantiate your form, pass in prefix='form1' as an
> argument - all the fields on the form will get that prefix, which will
> keep the two forms distinct in the POST dictionary. This will only be
> an issue if there is an overlap in the field names on the two forms,
> but it's bette
> can I run Django-based site on host provider that supports Python but
> has NO django installed??
You might find some useful information in this thread :
http://groups.google.com/group/django-users/browse_thread/thread/1c67d892907
d1abb/8fd08f175a11ac82?lnk=gst&q=httpd.conf&rnum=1#8fd08f175a11a
When a template variable value is None, is it expected to render the word
'None'? I would expect this to fail silently instead of displaying the word.
Is there a configuration setting or some way to change the default
rendering? Do I have to wrap variables with an {% if ... %} in order to not
displ
> If I open page to edit user's account, at the bottom is multiselect
> box containing all existing groups.
>
> If I select one(s) and save user profile, in DB table
> auth_user_grooups I see a correct links between auth_user and
> auth_group table.
>
> But I cannot find the same information in
> > Ahhh. So after I've used login() once in a test, get() will pass the
> > existing session cookie, in which case my test to retrieve two pages
> while
> > logged in would look like :
> > client.login(...)
> > client.get(...)
> > Does that sound right ? I'll try that later today.
>
> Sounds lik
> If you're wanting it for actual inclusion, there's also the edge case
> of whether the model's been saved. If not PK is None, and the URL
> will be mal-formed.
>
> I dunno what to do for that corner case.
I guess it might make sense to return the "add" url instead, although that
makes it twic
> Small tweak to support models which don't use AutoField for primary_key.
>
> def get_admin_url(self):
>pk = getattr(self, self._meta.pk.attname)
>return "/admin/%s/%s/%s/" % (
> self._meta.app_label,
> self._meta.module_name,
> pk)
Hmmm. Nice, except that it hardcodes
in_change_url method ?
Thanks,
Chris Brand
--~--~-~--~~~---~--~~
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 th
> > I'm running into problems with the test client's login method.
> > Specifically, within a single test method, the first login succeeds but
> the
> > second one fails.
> > Is this something that should work ? Am I doing something wrong ?
>
> The 'bool object has no attribute status_code' messa
> I have a "Category" and "Theme" table. Each category can have a number
> of themes, and while a theme with the same name can belong to
> different categories, more than one theme with the same name shouldn't
> belong to the same category. I'm having a hard time figuring out how
> to set this up
> > I just wonder why this permission is not part of the default
> > permissions (like add, change and delete)?
> >
> > David
> >
> No more thoughts about that? I'm really surprised that it only happens
> to me, maybe I will be luckier on the users' mailing-list?
Chapter 18 of the Django book (ht
> > Is there a way to tell Admin to use HTTPS rather than HTTP for these
> links ?
>
> I guess if you admin site was accessed over https it would work.
> Otherwise, no, since it is a relative URL (and then redirected via an
> HTTP redirect), so it has to use the same schema (and hostname) as the
> But my admin site *is* accessed through https.
> The "View on site" button links to a URL like https://[...]/admin/r/11/1/,
> but when I click on it, it redirects to http://[...]/[get_absolute_url()
> output]
I'd guess that it ends up at
http://code.djangoproject.org/browser/django/trunk/django
age which would actually show something. Apart from that one "s", the
resulting URL is fine, but it's a pretty important "s".
Is there a way to tell Admin to use HTTPS rather than HTTP for these links ?
Failing that, is there a way to turn them off (as
#x27;)
self.failUnlessEqual(r.status_code, 403)
That last line causes this error :
self.failUnlessEqual(r.status_code, 403)
AttributeError: 'bool' object has no attribute 'status_code'
I can't even see how to work out why it's failing (if I swap the two login
calls,
> > class Link(models.Model):
> > link = models.URLField()
> > user = models.ForeignKey(User, unique=False)
> > text = models.TextField(maxlength = 20)
> > votes = models.IntegerField()
> >
> > I want some of the fields to have defaults, like I want votes to have
> > a default valu
Mike Schinkel wrote:
> Malcolm Tredinnick wrote:
> > Outlook has had rule-based sorting into other mailboxes for a
> > while, so I would have thought it was possible to use that.
>
> It does have that. And I tried that for a while, but found it to be
> "out-of-sight, out-of-mind." It's worse tha
track this down (that seems likely to be available,
but I don't know for sure).
(For the curious, I'd missed a comma between two parameters where I called
render_to_response()).
Chris Brand
--~--~-~--~~~---~--~~
You received this message
> I guess you're looking for any permissions that are for the 'lab' app?
>
> Consider moving this into the view or writing a template tag-- There's
> not an easy way to do str.startswith in a template, which is what
> you'd need here.
I thought you could do {% if perms.lab %} for "any permission
> >>> from mysite.rugs.models import Choice, Size, Price
> >>> c = Choice.objects.filter(choice=1)
> >>> c
> [, , ]
You can see here that your queryset maps to three objects.
> >>> c.size.name
> Traceback (most recent call last):
> File "", line 1, in ?
> AttributeError: 'QuerySet' object has
> I think if it were me I'd build a form builder function, metaclass, or
> do it in __init__. Probably the easiest is passing in an argument to
> __init__ , that gives enough information to build the form.
That sounds like the kind of thing I'm looking for.
Thanks very much once again,
Chris
After a few false starts, I managed to get this going.
Now my problem is that this approach only really works for Booleans.
What if I wanted a form to enter test scores for a class, one score per
student ?
All my approaches so far have ended up with multiple fields with the same
name, which then d
> For the attendance form, you might use a MultipleChoiceField
> checkboxSelectMultiple widget, where the value of each choice is set
> to the pk of the student model. You should get a list of id's that
> were checked when the form gets submitted.
Thank you very much. Sounds like that approach
udent/blog entry, but I'm having a hard time visualizing it.
Thanks in advance for any advice,
Chris Brand
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post t
> What version of Python are you using? I *think* FloatFields are
> returned as Python Decimal objects, which don't exist before
> Python-2.4, which means you would then get a string from MySQLdb. We
> might need a fix for Django on Python-2.3 to work around this.
"python -V" reports "Python 2.4.
nition :
min_age = models.FloatField("Minimum age", max_digits=3,
decimal_places=1, default=0, validator_list=[age_validator])
Why is this ?
I'm using 0.96 with a MySQL backend.
Chris Brand
--~--~-~--~~~---~--~~
You received this message becau
What's the best way to restrict access on a per-app basis ?
I want to have two apps, with some users allowed access to one, others
allowed access to the other, and some allowed access to both.
Any advice would be very much appreciated.
Thanks,
Chris
--~--~-~--~~~
What's the best way to restrict access on a per-app basis ?
I want to have two apps, with some users allowed access to one, others
allowed access to the other, and some allowed access to both.
Any advice would be very much appreciated.
Thanks,
Chris
--~--~-~--~~~-
In the Admin subclass of my class, is it possible to follow relations for
list_display() and/or list_filter() ?
When I'm dealing with applications, it would be nice to be able to
filter/sort them by the squadron name of the related cadet, for example.
Chris
--~--~-~--~~--
> On 2/27/07, Ramiro Morales <[EMAIL PROTECTED]> wrote:
> > Please apply & test the patch attached to ticket # 2076
>
> But it could be of great help in you situation and it would be great
> if you help us by testing it.
I will do so, but it's going to be a week or so before I have the time to
g
Having gone on a dot-removal frenzy, I still have this one that fails :
>>> from camps import models
>>> app_list =
models.Application.objects.select_related().order_by('camps_board_time_block
.start_time')
>>> app_list
Traceback (most recent call last):
File "", line 1, in ?
File
"/usr/lib/py
> You have an addiction to dots...if you were doing unit tests,
> this would be A Good Thing(tm) :) However, in an ORDER BY
> clause, not so much.
I wouldn't cause it an addiction as such. I may occasionally use them a
little more than is good for me...:-)
>
> IIUC, you need to do a select_rela
> Can you create a ticket with this on it so I don't lose track of it?
http://code.djangoproject.com/ticket/3587
Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
> > Please do elaborate on this. AFAIK FKs in filter() work just fine, so
> > if there's something broken we should know about it right away.
>
> I found ticket 2076, but that only concerns order_by().
>
> I haven't got access to my code at the moment.
Ok, I got hold of my code.
Of course (I h
> I'm not sure how Chris is filtering/ordering, but there are
> several ways of specifying fields, depending on the context. In
> filtering, one needs to use the double-underscore scheme as in
>
> Foo.objects.filter(foreignfieldname__foreignfield = 42)
>
> whereas in ordering, IIRC, you h
> Please do elaborate on this. AFAIK FKs in filter() work just fine, so
> if there's something broken we should know about it right away.
I found ticket 2076, but that only concerns order_by().
I haven't got access to my code at the moment.
Chris
--~--~-~--~~~---~
> If there's a bug that's been annoying the heck out of you and you want
> it fixed before the release, this would be the time to speak up about
> it. We have a fairly high concentration of Django developers all in
> one place with nothing to do but code, so hopefully we'll be able to
> hit a lot
> I then erase my apps database and run 'manage.py syncdb'
Are you aware that you don't have to erase the database before running
syncdb ? If you don't erase the db, you won't need to recreate the
superuser...
Chris
--~--~-~--~~~---~--~~
You received this mess
Try {{ object.pub_date|date }}
Chris
> -Original Message-
> From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of Matias
> Sent: 4 February 2007 1:50 PM
> To: Django users
> Subject: DATETIME_FORMAT ignored
>
>
> Hi,
>
> Hi,
>
> I'm my settings.py I've added th
> > The problem is that it resets when the visitor first comes to the page.
> > In other words, when I go to the site first thing in the morning
> > last_seen resets to NOW.
But that's exactly what your code says :
> > l = request.session['last_seen']
> > last = now -l
>
I've got some float fields in my model that default to 0.0.
In my templates, it would be nice to use something like the "if" tag to
display something like "Not set". I do seem to be able to do this with
integer fields that default to zero.
Can I do this with a built-in tag ?
Chris
--~--~-
I have the feeling that this is something that should be straightforward,
but I can't see how to do it.
I have an app with Applications, each of which is for a single Camp.
What I want to do is retrieve all the Camps for which there exists an
Application.
Thanks,
Chris
--~--~-~--~--
> Each instance of your model will have a special method name
> 'get_foo_display', where 'foo' is the name of the field with the
> choices. For example:
I should have found that. Thanks.
> >>> b.get_kind_display()
Presumably I can also use that in a template :
{% object.get_kind_display %}
Chr
I have model with field with choices set, similar to that in the
documentation at
http://www.djangoproject.com/documentation/model_api/#choices
In the admin, it displays the current value nicely (the second column), but
on my page, it displays the actual value from the database (the first
column)
usually app disappears when some run-time error happends (or when
thereare no class Admin: in
models.py but I think you did not altered that, right?)
It was indeed a run-time error.
One of my import statements was missing the project name (i.e. I had "from app.models
import..." rather than
I got apache with mod_python up and running ok.
Then I used manage.py reset on one of my apps.
Since then, I can't see that app in the Admin page. It was showing up fine
before. It also shows up fine if I use the development server.
I've restarted apache, my browser and even mysqld, all to no
i'm trying to create a model which referencing itself
The documentation says :
To create a recursive relationship -- an object that has a many-to-one
relationship with itself -- use models.ForeignKey('self').
Chris
--~--~-~--~~~---~--~~
You received this me
63 matches
Mail list logo