Re: get translated text from ugettext_lazy() result

2009-02-26 Thread Arien
;>>> r.get_ui_display() > 3 Just a guess: you're using some kind of *integer* model field but since your choices are tuples with *strings* as the first element. Use integers for the first element of each tuple instead: RATING_CHOICES = ( (0, _('I don\'t know')), (1, _('Ve

Re: 'blocktrans' doesn't allow other block tags (seen u'plural') inside it

2009-02-05 Thread Arien
alue as user_points_value_t %} ... That's {{ user_points_value_t}} entry. ... {% plural %} ... That's {{ user_points_value_t}} entries. ... {% endblocktrans %} ... """) >>> print t.render(Context({'user_points_value': 1})).strip() That's 1 entry. >>> print t.rende

Re: Saving tests' output to a file in Windows

2008-07-22 Thread Arien
tdout and stderr to a file like this: set PYTHONPATH=E:\django runtests.py --settings=settings > results.txt 2>&1 Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Adding and removing template dirs on the fly

2008-07-18 Thread Arien
ng templates, you could always write a template tag to do just that. And maybe you can solve it using some combination of template inheritance, inclusion and select_template. Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Re: Adding and removing template dirs on the fly

2008-07-17 Thread Arien
adding another template directory for the > specific channel. Have you seen the section on loading templates in the documentation? It contains a tip that describes how you can use select_template to nicely deal with this type of situation: http://www.djangoproject.com/documentation/templat

Re: request getlist() in order?

2008-07-17 Thread Arien
quest processing preserves this order when converting the encoded data to MultiValueDicts. > I'm trying to determine if I can do something the easy way (depend on > the order as provided in the form) or do I have to name the fields in > such a way to remember the order on POST. You most like

Re: Need help in using ComboField for Forms

2008-07-17 Thread Arien
ms/fields.py?rev=7859#L1104 Arien --~--~-~--~~~---~--~~ 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: Modulo of 4 not working right

2008-07-16 Thread Arien
r, but probably > not enough to make much different in the real world. Faster and more readable (imho): >>> def make_divisible_by_4(num): ... div, mod = divmod(num, 4) ... return mod and (div + 1) * 4 or num ... >>> make_divisible_by_4(8) 8 >>> make_divisible_by_4(

Re: How to access the label of a model instance

2008-07-15 Thread Arien
On Tue, Jul 15, 2008 at 2:08 PM, Arien <[EMAIL PROTECTED]> wrote: > Oh, I see, you want the verbose_name of each field. I suppose you > could write a templatetag that you could use like this: > > {% verbose_name layer.heating_temperature %} > {{ layer.heating_temperature

Re: How to access the label of a model instance

2008-07-15 Thread Arien
On Tue, Jul 15, 2008 at 1:22 PM, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Arien writes: >> You'll have to make layer._meta.verbose_name available to the >> template under some other name. > > Unfortunately, I use model polymorphism and model inheritance in > thi

Re: escape filter

2008-07-15 Thread Arien
that doesn't seem to be the case.) Why do you need to use HTML entities for accented characters? What is the problem you're trying to solve? Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: How to access the label of a model instance

2008-07-15 Thread Arien
On Tue, Jul 15, 2008 at 12:00 PM, Torsten Bronger <[EMAIL PROTECTED]> wrote: > > Hallöchen! > > Arien writes: > >> On Tue, Jul 15, 2008 at 10:53 AM, Torsten Bronger >> <[EMAIL PROTECTED]> wrote: >> >>> In a display template (not a form, just di

Re: escape filter

2008-07-15 Thread Arien
flatpage.content|escape }} > > > > > I was expecting to see all accented chars in title and contents to be > displayed properly escaped, however, I'm seing the "raw" chars. What am > I doing wrong? You can use the force_escape filter to escape <, >, quotes

Re: How to access the label of a model instance

2008-07-15 Thread Arien
to use the verbose_name of the model instance instead of > hard-wiring the label in the template. How can I access it? The verbose_name is at layer._meta.verbose_name. You can't access it like that from your template, though. Arien --~--~-~--~~~---~--~

Re: integer digit limit

2008-07-15 Thread Arien
l attrs keyword argument (a dictionary) for HTML attributes of the widget. The HTML attribute you're looking for is maxlength: some_field = forms.IntegerField(widget=forms.TextInput(attrs={'maxlength': 6})) Arien --~--~-~--~~~---~--~~ You received this mess

Re: Trying to install django

2008-07-15 Thread Arien
On Tue, Jul 15, 2008 at 9:58 AM, Arien <[EMAIL PROTECTED]> wrote: > On Tue, Jul 15, 2008 at 9:27 AM, Ralph <[EMAIL PROTECTED]> wrote: >> >> I'm trying to install django for the first time. [...] > What I do is this: > > 1. check out the svn version to some dire

Re: Trying to install django

2008-07-15 Thread Arien
ges\django.pth which contains c:\svn\django-trunk (or whatever path you used in step 1.) Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Site wide date format

2008-07-15 Thread Arien
lter? For example, I > want {{ var.date|date }} to format to {{ var.date|date:"l, F j Y" }} > unless I specify otherwise, but still have the ability to format it > differently in some cases. Is this possible? Use the DATE_FORMAT setting: http://www.djangoproject.

Re: Setting the time on a datetimefield

2008-07-15 Thread Arien
explanation! The logical explanation is that adjusting the hour of a date doesn't make sense, because a date doesn't have any hour. ;-) Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Setting the time on a datetimefield

2008-07-15 Thread Arien
ime then was only a date. This shouldn't happen: a DateTimeField normalizes to a datetime.datetime object. Are you sure you're not using a DateField in your form? Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Re: delete or update a model

2008-07-15 Thread Arien
on/db-api/#deleting-objects Arien --~--~-~--~~~---~--~~ 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, s

Re: instance needs to have a primary key value before a many-to-many relationship can be used.

2008-07-15 Thread Arien
On Tue, Jul 15, 2008 at 2:06 AM, tom17 <[EMAIL PROTECTED]> wrote: > > Found out: > id = models.AutoField(primary_key=True) Or leave the id field out entirely. See: http://www.djangoproject.com/documentation/model-api/#automatic-primary-key

Re: Multi-level template blocks

2008-07-15 Thread Arien
1.html") > c = Context( { "title":"Layer One Special One", "noun":"Stuff", > "verb":"Django" } ) > print t.render(c) > > should print: > > > Layer One Special One > > Header Stuff > >

Re: How to display the images in the template page under the django development server

2008-07-11 Thread Arien
/localhost:8080/mysite_media/' This MEDIA_URL doesn't match what you've specified in your URLconf. You'll want to pick one of the two. Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Re: Too many values to unpack error

2008-07-09 Thread Arien
= ( ('general', 'General enquiry'), > ('bug', 'Bug report'), > ('suggestion' 'Suggestion'), > ) You're missing a comma in the last-but-one line. (It evaluates to the concatenation of the two strings, so you get a sequence

Re: Response wit File Name

2008-07-09 Thread Arien
on't use this header) I think you'll find that the name the browser suggests is based on the Content-Disposition header or something that looks like a file name at the end of the URL (before the question mark and query string, if any). Arien --~--~-~--~~~---~--~~ Y

Re: Grouping Items In Multiple Categories

2008-07-08 Thread Arien
ittee_type.list %} {{ committee.name }} {% endfor %} {% endfor %} {% endfor %} Arien --~--~-~--~~~---~--~~ 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@google

Re: newforms-admin: root() takes exactly 3 arguments (2 given)

2008-07-07 Thread Arien
re is no > way to specify arguments in urls.py, so I have no idea how to fix > this. You want to capture the part of the path that' s "inside" your admin site: (r'^admin/(.*)', site1.root) This way the view gets its three arguments. Arien --~--~-~--~~-

Re: sessions in template (outside of views)

2008-06-30 Thread Arien
;django.core.context_processors.media", "django.core.context_processors.request", ) There's more explanation about this in the docs here: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext Arien --~--~-~--~~~-

Re: sessions in template (outside of views)

2008-06-30 Thread Arien
(That was the point of all this, right?) So to display the value of request.session['City'], for example, you'd use this in your template: {{ request.session.City }} Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: sessions in template (outside of views)

2008-06-29 Thread Arien
equest context processor, making sure to always use a RequestContext when rendering the template. Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: intial form field values using session variables

2008-06-27 Thread Arien
{{request.session["whatever"] }} > > but it says it can't parse the remainder... Use the syntax of Django's template language: {{ request.session.whatever }} Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Newforms and textareas

2008-06-27 Thread Arien
areas: > > class RandomEditForm( ModelForm ): >description = HtmlField() > > Now the question is: where can I set the ROWS attribute for this > Textarea? See http://www.djangoproject.com/documentation/newforms/#specifying-widgets Arien --~--~-~--~~---

Re: ModelForm's error dict is filled before is_valid() is called

2008-06-27 Thread Arien
] > > Is the documention or the behavior wrong? Neither. As explained in the docs "the form's data will be validated the first time either you call is_valid() or access errors", see http://www.djangoproject.com/documentation/newforms/#using-forms-to-validate-data Arien --~--~-~-

Re: intial form field values using session variables

2008-06-27 Thread Arien
required=True, > label = "Account #") > > i'm getting this: > > NameError: name 'request' is not defined > > > how do i use a session variable for initial data? You can pass in an "initial" argument when you instantiate your Form, as explained here: http:

Re: Collecting referrers data

2008-06-27 Thread Arien
On Fri, Jun 27, 2008 at 3:45 AM, Alessandro <[EMAIL PROTECTED]> wrote: > So, it's possible to make a shortcut before my urls and generic views > to record referrers data? You could write some middleware to do just that. Arien --~--~-~--~~~---~--~~

Re: How best to delete one of multiple records?

2008-06-24 Thread Arien
duction setting. (For example, using Django's development webserver or having DEBUG = True in your settings module.) Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: File IO Operations

2008-06-24 Thread Arien
n tutorial[1] and the documentation for the os module[2]. Arien [1] http://docs.python.org/tut/node9.html [2] http://docs.python.org/lib/os-file-dir.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django u

Re: dynamic value of a ModelChoiceField

2008-06-24 Thread Arien
-) shows up. Ehhmm... Have you actually executed the code above? (You can't "assign" to a form's fields like that.) Anyway, you may want to read the documentation for newforms[1] and ModelForms[2]. Arien [1] http://www.djangoproject.com/documentation/newforms/ [2] http://www.djangoproje

Re: How best to delete one of multiple records?

2008-06-23 Thread Arien
> > Yes, this is a recommendation, not a dogma. IMHO GET method is > suitable for dense tables with dozens of operations. Whether it's a good idea to use GET or not doesn't depend on presentation issues. Arien --~--~-~--~~~---~--~~ You received this messag

Re: Trouble querying across relationships

2008-06-19 Thread Arien
want something like "filter the attractions in such a way that the name of the city of the related event is ... and eliminate duplicates in the resulting list": attractions = Attraction.objects.filter(event__city__name='...').distinct() The details depe

Re: redirect with post parameters

2008-06-18 Thread Arien
URI. This means that a POST > request receiving a 307 should lead to another POST request with the > same parameters (note: I'm not sure if you can ask for an alteration > of the post parameters, but I doubt it) If the request method is not "safe" (not GET or HEAD

Re: Template engine

2008-06-13 Thread Arien
t; > I really wish it had some whitespace handling tools like Cheetah > http://www.cheetahtemplate.org/docs/users_guide_html/users_guide.html#SECTION00068 Or Template Toolkit's: http://template-toolkit.org/docs/manual/Syntax.html#section_Cho

Re: Can Someone Do something about ALL THIS SPAM

2008-06-05 Thread Arien
ch=Movado+Watches > http://www.jewelerslounge.com > http://www.goldwatches.com ^^^^^ Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: django_sessions table getting out of hand

2008-05-09 Thread Arien
On Fri, May 9, 2008 at 7:28 AM, Matt Davies <[EMAIL PROTECTED]> wrote: > What's the best method of keeping the django_sessions table from growing so > large? Well, there's django/bin/daily_cleanup.py ;-) Arien --~--~-~--~~~---~--~~ You received

Re: Translation issues in admin app

2008-04-25 Thread Arien
iving your models verbose names in the accusative ("robota") instead of in the nominative ("robot")... But at least it will be pretty on the outside. Arien --~--~-~--~~~---~--~~ You received this message because you are subscribed t