Re: Lets talk about a dynamic limit_choices_to again :)

2007-11-25 Thread Dmitri Fedortchenko
liar with edit_inline code has some suggestions, please chime in :) //Dmitri On Nov 25, 2007 7:04 PM, William Waites <[EMAIL PROTECTED]> wrote: > > On Fri, Nov 23, 2007 at 02:05:28PM -0800, Dmitri Fedortchenko wrote: > > > > I found this ticket: > > http://code.django

Lets talk about a dynamic limit_choices_to again :)

2007-11-23 Thread Dmitri Fedortchenko
I found this ticket: http://code.djangoproject.com/ticket/2445 It's not seen much activity for a while, but in september jkocherhans posted some news which I found interesting. So since I needed this functionality, I wrote a patch for it. The patch is still shaky on edit_inline objects, but it w

Re: Using filters with {% trans %} tag

2007-11-19 Thread Dmitri Fedortchenko
Expression for some strange hacks, then they may have some issues. //D On Nov 18, 4:41 pm, Dmitri Fedortchenko <[EMAIL PROTECTED]> wrote: > I found something. > > FilterExpression seems to be a bad boy. > > Check out these two pieces of code (in the __init__

Re: Using filters with {% trans %} tag

2007-11-18 Thread Dmitri Fedortchenko
lace('\"','"') to the "constant" in the first piece of code will solve this little problem and it seems only fair that you should be able to escape doublequotes (since it's clearly possible in filter arguments)... Should I start a new ticket for this or ba

Re: Using filters with {% trans %} tag

2007-11-17 Thread Dmitri Fedortchenko
w it's time for bed. //D On Nov 18, 4:09 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2007-11-17 at 17:47 -0800, Dmitri Fedortchenko wrote: > > Once again I return with my whacky ideas. > > > I want to apply filters to my translations in the templates.

Re: django.template.TokenParser inconsistent when it comes to filters...

2007-11-17 Thread Dmitri Fedortchenko
/Dmitri On Nov 18, 4:08 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2007-11-17 at 18:27 -0800, Dmitri Fedortchenko wrote: > > The django.template.TokenParser has a little problem. > > > I am not sure if this is a problem actually, but it is inconsistent > >

django.template.TokenParser inconsistent when it comes to filters...

2007-11-17 Thread Dmitri Fedortchenko
The django.template.TokenParser has a little problem. I am not sure if this is a problem actually, but it is inconsistent when parsing filters that follow constant strings or variables. Meaning that: {% tag thevar|filter sometag %} will produce: self.value() = "thevar|filter" self.tag() = "somet

Using filters with {% trans %} tag

2007-11-17 Thread Dmitri Fedortchenko
Once again I return with my whacky ideas. I want to apply filters to my translations in the templates. So. I have created a patch which allows use of the following syntax: {% trans "username"|capfirst|slice:"2:" noop %} {% trans somevar|slice:"2:" %} The filters are applied on the resu

Re: Templates: {% trans %} {% some_tag _() %} and {{ _() }} what gives?

2007-11-07 Thread Dmitri Fedortchenko
007-11-07 at 13:01 +, Dmitri Fedortchenko wrote: > > I am trying to figure out the state of the translation tags in the > > django template system. > > > > My ticket has been rejected, but I am not satisfied with the RTFM > > answer given there, based on the claim

Templates: {% trans %} {% some_tag _() %} and {{ _() }} what gives?

2007-11-07 Thread Dmitri Fedortchenko
I am trying to figure out the state of the translation tags in the django template system. My ticket has been rejected, but I am not satisfied with the RTFM answer given there, based on the claim that python-stuff should not work in the template system. So why then do the i18n docs state that {%

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
> > On 11/7/07, Dmitri Fedortchenko <[EMAIL PROTECTED]> wrote: > > > > The Admin class should be able to define post_ and pre_save hooks that > are > > called before or after all Manipulation of the model is done (there are > > post_save hooks for th

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
after all Manipulation of the model is done (there are post_save hooks for the save method, but they are still called before the Manipulator is done working with the model) On 11/7/07, Collin Grady <[EMAIL PROTECTED]> wrote: > > > Dmitri Fedortchenko said the following: > > W

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
re is that your site is edited by a staff, or a client, or maybe just you — and you don't want to have to deal with creating backend interfaces just to manage content.] The message seems clear to me. ;) //D On 11/7/07, Collin Grady <[EMAIL PROTECTED]> wrote: > > > Dmitri F

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
That is what I thought as well, however I checked, and the _add_items() method is only called once with the correct objects (meaning the existing keywords and the keywords that I added). Are you telling me that the admin actually has it's own method for setting the relationships that is outside t

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
tails this very problem: http://www.progprog.com/articles/2007/03/03/django-when-save-is-not-safe It seems that no simple solution exists yet... //D On Nov 7, 2:25 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2007-11-07 at 00:50 +, Dmitri Fedortchenko wrote: > >

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
admin list_display. So whenever a list is displayed this method is called and thus the body of the article is scanned for keywords to be added. Not the most optimal solution, but the only one I could think of. Still, the most logical course is to override the save method. //D On Nov 7, 1:50 am, D

Re: Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-07 Thread Dmitri Fedortchenko
itial post. So repeating this should not be a problem... I'll try to delve deeper into the transaction side of things, but any insight you can give me would be appreciated. //Dmitri On Nov 7, 2:25 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2007-11-07 at 00:50 +,

Overriding a Model's save() method does not allow proper creation of ManyToMany related objects

2007-11-06 Thread Dmitri Fedortchenko
Example code: def save(self): regex = re.compile("\{\{([^\}]{2,60})\}\}") words = regex.findall(self.body) self.body = regex.sub("\\1",self.body) super(Chapter,self).save() for word in words: if len(word.strip()) > 0:

Re: Stripping spaces and linebreaks from blocktrans?

2007-10-31 Thread Dmitri Fedortchenko
Sounds good. I'll try to clean up the patch as much as possible when I get some time too. Right now it's a little rough around the edges. //D On 11/1/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Wed, 2007-10-31 at 19:17 +0100, Dmitri Fedortchenko wro

Re: Stripping spaces and linebreaks from blocktrans?

2007-10-31 Thread Dmitri Fedortchenko
I opened a ticket, looking forward to your input and ideas. http://code.djangoproject.com/ticket/5849 On 10/31/07, Dmitri Fedortchenko <[EMAIL PROTECTED]> wrote: > > Now that I re-read your definition, there is one difference between your > suggestion and my patch. > My patch j

Re: Stripping spaces and linebreaks from blocktrans?

2007-10-31 Thread Dmitri Fedortchenko
Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Sun, 2007-10-28 at 21:46 +, Dmitri Fedortchenko wrote: > > That's a great idea! I'll see if I can squeeze out a patch for this, > > since I feel that I want to be able to indent blocktrans without > > having the

Re: Stripping spaces and linebreaks from blocktrans?

2007-10-31 Thread Dmitri Fedortchenko
<[EMAIL PROTECTED]> wrote: > > > On Sun, 2007-10-28 at 21:46 +, Dmitri Fedortchenko wrote: > > That's a great idea! I'll see if I can squeeze out a patch for this, > > since I feel that I want to be able to indent blocktrans without > > having the extr

Re: Stripping spaces and linebreaks from blocktrans?

2007-10-28 Thread Dmitri Fedortchenko
d we strip the subsequent lines based on the indentation of the second line, or assume that the user wants to keep the text as is? :) Please advise. On Oct 27, 12:41 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-10-26 at 15:04 +, Dmitri Fedortchenko wrote: >

Stripping spaces and linebreaks from blocktrans?

2007-10-26 Thread Dmitri Fedortchenko
I've started using blocktrans in my templates and noticed that when using make_messages it includes all the tabs and linebreaks around the text that is surrounded by blocktrans tags. For example: {% blocktrans %} Translate this string {% plural %}