Support for macros in templates

2007-08-10 Thread Michal Ludvig
Hi all, This is a little announcement of a tag library for {% macro %} support in Django templates. I have been using TAL template engine in my previous project and got used to the concept of "macros" as building blocks of the final HTML output. Now in Django I realised the missing support for "

Re: Support for macros in templates

2007-08-11 Thread Michal Ludvig
olivier wrote: > Hi Michal, > > On 11 août, 04:51, Michal Ludvig <[EMAIL PROTECTED]> wrote: > >> It works pretty well and the only drawback is that the defined macros >> are local to each template file, i.e. are not inherited through >> {%extends ...%}

Re: Database Fields

2007-08-17 Thread Michal Ludvig
b3n wrote: > Why doesn't Django create primary key integer and tinyint integer > database fields as UNSIGNED? Assuming you're talking about MySQL ... > Especially where a field is used as a flag. e.g. auth_user > > is_staff = tinyint(1) > is_active = tinyint(1) > is_superuser = tinyint(1) > >

Re: Database Fields

2007-08-17 Thread Michal Ludvig
b3n wrote: > Thanks, > > OK, but if a field value is only ever going to be 0 or 1, why make it > signed? It's misleading. Signed is MySQL default. Use e.g. PositiveSmallIntegerField if you want it unsigned. > And what is the purpose of INT(11), why should it be that instead of > INT(10) ? Agai

[solution] Re: Template Macros Like In Jinja

2008-01-22 Thread Michal Ludvig
Hi Papa > i wonder if there is any way to have Macros in django templates > similar to what Jinja has (http://jinja.pocoo.org/)? Have a look at "Support for {% macro %} tags in templates" at http://www.djangosnippets.org/snippets/363/ I bet it's exactly what you're after. It lets you define ma

Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig
Hi all, for the project I'm working on I needed to create a custom template tag, call it 'mytag'. If I use it as {% mytag something %} everything goes fine (where 'something' is a string passed to the template). However I can't add any filters to that 'something'. As soon as I do: {% mytag somet

Re: Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig
Rune Bromer wrote: > On Dec 5, 2007, at 11:59 AM, Michal Ludvig wrote: > >> Hi all, >> >> for the project I'm working on I needed to create a custom template >> tag, >> call it 'mytag'. >> >> If I use it as {% mytag something %} e

(solved) Re: Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig
Michal Ludvig wrote: > for the project I'm working on I needed to create a custom template tag, > call it 'mytag'. > > If I use it as {% mytag something %} everything goes fine (where > 'something' is a string passed to the template). > However I ca

How to get SQL "NOT IN" query from filter()

2007-12-16 Thread Michal Ludvig
Hi all, I have a simple model with 'id' as a primary key and I have a list of IDs that were already processed in variable 'processed_ids'. How can I retrieve all objects that are *not* in that list? Something like "Model.objects.filter(id__not_in = processed_ids)". Unlike filter(id__in=...) whi

Re: How to get SQL "NOT IN" query from filter()

2007-12-16 Thread Michal Ludvig
Tim Chase wrote: >> How can I retrieve all objects that are *not* in that list? >> >> Something like "Model.objects.filter(id__not_in = processed_ids)". >> Unlike filter(id__in=...) which works just fine the __not_in modifier >> apparently isn't understood by django. > > > As commented recently

Filter ForeignKey values in model's admin view

2013-11-18 Thread Michal Ludvig
Hi I've got two Django models: Contact and Group, where Group has two fields: contact and contact_primary linked to Contact. Like this: |class Group(models.Model): name = models.CharField(max_length=200) contacts = models.ManyToManyField(Contact) contact_primary = models.ForeignKey(Co

Re: Filter ForeignKey values in model's admin view

2013-11-19 Thread Michal Ludvig
On 19/11/13 17:10, Michal Ludvig wrote: > > Hi > > I've got two Django models: Contact and Group, where Group has two > fields: contact and contact_primary linked to Contact. Like this: > > |class Group(models.Model): > name = models.CharField(m