Re: Multi-level template blocks

2008-07-15 Thread Arien
r1-special1.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: 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: 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: Setting the time on a datetimefield

2008-07-15 Thread Arien
e in datetime 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

Re: Setting the time on a datetimefield

2008-07-15 Thread Arien
#x27;t really understand why, but I'm sure there's a logical > 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

Re: Site wide date format

2008-07-15 Thread Arien
t; filter? 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.djangopro

Re: Trying to install django

2008-07-15 Thread Arien
\Lib\site-packages\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 gr

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

Re: integer digit limit

2008-07-15 Thread Arien
an optional 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 --~--~-~--~~~---~--~~ Y

Re: How to access the label of a model instance

2008-07-15 Thread Arien
I'd like 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: 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 <, >

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
or some reason, but 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 G

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 >

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: Modulo of 4 not working right

2008-07-16 Thread Arien
aster, 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_divis

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: request getlist() in order?

2008-07-17 Thread Arien
and Django's request 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 orde

Re: Adding and removing template dirs on the fly

2008-07-17 Thread Arien
ing 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/te

Re: Adding and removing template dirs on the fly

2008-07-18 Thread Arien
idea? If it turns out that the only solution for your problem is to have some fallback mechanism when including 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 --~--~

Re: Saving tests' output to a file in Windows

2008-07-21 Thread Arien
You can redirect both stdout 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 u

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

2009-02-05 Thread Arien
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 ent

Re: get translated text from ugettext_lazy() result

2009-02-26 Thread Arien
t;> r.get_delivery_display() > 3 >>>> 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_CHOIC

Re: Translation issues in admin app

2008-04-25 Thread Arien
[the user has] changed robot") I'm guessing you'll end up giving 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 --~--~-~--~~

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

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: Template engine

2008-06-13 Thread Arien
> > 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#s

Re: redirect with post parameters

2008-06-18 Thread Arien
ated against another 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 "sa

Re: Trouble querying across relationships

2008-06-19 Thread Arien
e, you 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

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 t

Re: dynamic value of a ModelChoiceField

2008-06-23 Thread Arien
to the empty label (--) 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/n

Re: File IO Operations

2008-06-24 Thread Arien
torial[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: How best to delete one of multiple records?

2008-06-24 Thread Arien
a in a production 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" gro

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: intial form field values using session variables

2008-06-27 Thread Arien
h=20, 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 e

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: Newforms and textareas

2008-06-27 Thread Arien
r the textareas: > > 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: 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

Re: sessions in template (outside of views)

2008-06-29 Thread Arien
ocessors.request 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, se

Re: sessions in template (outside of views)

2008-06-30 Thread Arien
k to > the template. If you have activated the request context processor, the request is *automatically* passed to the template. (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: {{ req

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: newforms-admin: root() takes exactly 3 arguments (2 given)

2008-07-07 Thread Arien
akes 3 arguments: self, request, url. There 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

Re: Grouping Items In Multiple Categories

2008-07-08 Thread Arien
committee_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@g

Re: Response wit File Name

2008-07-09 Thread Arien
mes that don'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 --~--~-~--~~---

Re: Too many values to unpack error

2008-07-09 Thread Arien
OICES = ( ('general', 'General enquiry'), > ('bug', 'Bug report'), > ('suggestion' 'Suggestion'), > ) You're missing a comma in the last-but-one line. (It eva

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

2008-07-11 Thread Arien
OOT = "D:/test/mysite/mysite_media" > MEDIA_URL = 'http://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 re