Re: Cache and i18n

2009-05-21 Thread Dmitriy Sodrianov

On 20 май, 23:13, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Wed, May 20, 2009 at 12:01 PM, Dmitriy Sodrianov <sodr...@gmail.com>wrote:
>
>
>
>
>
> > Hi, there!
>
> > I've configured bilingual site. At this site some forms are present.
> > All the forms field 'verbose_name' attribute are marked with ugettext
> > utility.
>
> > The problem is that when language is changed labels for form's fields
> > does not change.
>
> > All the localization files are provided and properly configured.
>
> > Is that somehow related to cache of page? Tried to use never_cache
> > decorator, didn't help.
>
> You need to use ugettext_lazy, since strings for fields are defined at the
> module level and are therefore evaluated when the class is compiled.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero

Thanks, that helped!
--~--~-~--~~~---~--~~
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, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Cache and i18n

2009-05-20 Thread Dmitriy Sodrianov

Hi, there!

I've configured bilingual site. At this site some forms are present.
All the forms field 'verbose_name' attribute are marked with ugettext
utility.

The problem is that when language is changed labels for form's fields
does not change.

All the localization files are provided and properly configured.

Is that somehow related to cache of page? Tried to use never_cache
decorator, didn't help.
--~--~-~--~~~---~--~~
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, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom handler404 for an app

2009-04-28 Thread Dmitriy Sodrianov

Hi there!

Is there a way of customizing handler404 for a different apps of the
project? That is - I have one app for a client part and one more for a
admin part and certainly they should have different designs at all.
--~--~-~--~~~---~--~~
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, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Allowing html tags for filter.

2008-04-11 Thread Dmitriy Sodrianov

Sure, here it is. It's quite simple.


@register.filter
def show_actions(obj):
ret = '''
execute
edit''' % (obj.id, obj.id)

return ret

Kenneth Gonsalves:
> On 11-Apr-08, at 10:05 PM, Dmitriy Sodrianov wrote:
>
> > I have a custom filter that outputs some html code. The problem is
> > that it converts all "greater than" and "less than" symbols to
> > appropriate   and  symbols. How is it possible to say to
> > filter not to do this?
>
> unless we see the code of the custom filter we could not give a solution
>
> --
>
> regards
> kg
> http://lawgon.livejournal.com
> http://nrcfosshelpline.in/code/
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Allowing html tags for filter.

2008-04-11 Thread Dmitriy Sodrianov

Hi to all!

I have a custom filter that outputs some html code. The problem is
that it converts all "greater than" and "less than" symbols to
appropriate   and  symbols. How is it possible to say to
filter not to do this?

Thanks.
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tree from the model.

2008-04-11 Thread Dmitriy Sodrianov

Is it possible to use only Django's built-in functions?

On 11 апр, 04:21, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> Try to use this very good applicationhttp://code.google.com/p/django-mptt/.
>
> On Apr 10, 11:15 pm, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote:
>
> > Hi to all.
>
> > I have a model that can be described briefly as follows:
>
> > class Task(models.Model):
> > title = models.CharField(max_length = 250)
> > subtasks = models.ManyToManyField('Task', null=True, blank=True)
>
> > How can I build atreeof task and subtask with level greater than
> > two?
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Tree from the model.

2008-04-10 Thread Dmitriy Sodrianov

Hi to all.

I have a model that can be described briefly as follows:

class Task(models.Model):
title = models.CharField(max_length = 250)
subtasks = models.ManyToManyField('Task', null=True, blank=True)

How can I build a tree of task and subtask with level greater than
two?

--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Parent/Child problem

2008-04-04 Thread Dmitriy Sodrianov

Thanks Alex, symmetrical argument solved the problem. You saved me a
lot of time!

On 4 апр, 13:28, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> a) It should be related to "self" not 'Task'.
>
> b) Add the kwarg: symmetrical=False, by default this is true and it
> makes it so the relationship is assumed to go both ways.
>
> On Apr 4, 2:22 am, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote:
>
> > Hi to all!
>
> > I have a model
>
> > class Task(models.Model):
> > title = models.CharField(max_length = 250)
> > subtasks = models.ManyToManyField('Task', null=True, blank=True)
>
> > The problem is that when I add subtask to task, task is also added to
> > subtask, look at the following code to see what I mean.
>
> > >>> subtask = Task.objects.create(title='subtask')
> > >>> task = Task.objects.create(title='task')
> > >>> task.subtasks.add(subtask)
> > >>> task.subtasks.all()
> > []
> > >>> subtask.subtasks.all()
>
> > []
>
> > But the thing I want it only to add subtask to task, not vice versa.
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Parent/Child problem

2008-04-04 Thread Dmitriy Sodrianov

Hi to all!

I have a model

class Task(models.Model):
title = models.CharField(max_length = 250)
subtasks = models.ManyToManyField('Task', null=True, blank=True)


The problem is that when I add subtask to task, task is also added to
subtask, look at the following code to see what I mean.

>>> subtask = Task.objects.create(title='subtask')
>>> task = Task.objects.create(title='task')

>>> task.subtasks.add(subtask)

>>> task.subtasks.all()
[]
>>> subtask.subtasks.all()
[]

But the thing I want it only to add subtask to task, not vice versa.
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Manipulating request.FILES

2008-04-02 Thread Dmitriy Sodrianov

Yes, that helped, thanks!

On 1 апр, 09:55, Cephire <[EMAIL PROTECTED]> wrote:
> Dimitri: I assume that you want to modify the name of the file that is
> submitted. It can be done in _save_FIELD_file of the model. Here is a
> snippet that i use to change the name of the uploaded avatar icon for
> the user.
>
> def _save_FIELD_file(self, field, filename, raw_contents, save=True):
> img_name = self.get_profphoto_filename()
> #if there is already an avatar, then delete it
> if os.path.exists(img_name):
> os.remove(img_name)
> (name,ext) = os.path.splitext(filename)
> filename = "%s%s" % (self.user,ext)
>
> super(userprofile, self)._save_FIELD_file(field, filename,
> raw_contents, save)
>
> for further ref, you may want to 
> read:http://gulopine.gamemusic.org/2007/nov/07/customizing-filenames-witho...
>
> hope this helps.
>
> regards,
> Joseph
>
> On Mar 31, 9:22 pm, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote:
>
> > Hi to all!
>
> > I'm stuck with the problem ofmanipulatingrequest.FILES. I need to do
> > the following thing - there is a form with the FileField in it, After
> > the submit file that is send with the form must be renamed and stored
> > in particular way, let's say md5 of client ID.
>
> > I have no idea of how to do the task.
>
> > Thanks.
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Manipulating request.FILES

2008-03-31 Thread Dmitriy Sodrianov

Hi to all!

I'm stuck with the problem of manipulating request.FILES. I need to do
the following thing - there is a form with the FileField in it, After
the submit file that is send with the form must be renamed and stored
in particular way, let's say md5 of client ID.

I have no idea of how to do the task.

Thanks.
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Relating model to itself.

2007-10-16 Thread Dmitriy Sodrianov

Hi to all!

Can anyone help me, why none of the following code works:

class Task(models.Model):
parent   = models.ForeignKey(Task)


class Task(models.Model):
parent   = models.ForeignKey(self)

As it can be seen from the code above, i want some tasks to have
parent, and a parent must be a task too.

But the only thing validation says is:

versatility.tasks: name 'Task' is not defined
or
versatility.tasks: name 'self' is not defined


--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Synchronising Database.

2007-07-18 Thread Dmitriy Sodrianov

Hi to all!

Imagine a situation when a Django model is installed into the database
with well-known command

manage.py syncdb

and then it is altered, let's say a new field is added to model.

After typing manage.py syncdb again the table is not synchronised with
the model despite the name of the command syncdb.

How should the process of synchronisation be performed?
To my mind only dropping table and recreating it should do the task.


--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MEDIA_URL MEDIA_ROOT problem.

2007-07-18 Thread Dmitriy Sodrianov

Thanks to all for help.
With your suggestions and links I've found out how to serve static files
with Django.
Now everything works just fine!



--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



MEDIA_URL MEDIA_ROOT problem.

2007-07-17 Thread Dmitriy Sodrianov

Hello everyone!

Let me ask for help with the following problem:

I want to attach css file to my template and I'm doing it in this
steps.

1) First edited setting.py file, MEDIA_URL and MEDIA_ROOT variables in
this way:

MEDIA_ROOT = '/home/sodrian/versatility/static/'

MEDIA_URL = 'http://127.0.0.1:8000/static/'

2) then in my base.html template pointed to the cascade style sheet
file:



But unluckily it doesn't work. I tries different solutions such as:



http://127.0.0.1/static/style.css;
type="text/css" media="screen" />

but nothing worked, template is shown but css is not loaded.

Could anyone solve this problem?


--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---