Re: Django graceful database errors

2017-06-07 Thread Damian Myerscough
leware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddlew

Django graceful database errors

2017-06-07 Thread Damian Myerscough
Hello, I have setup a Django project that is being served via Nginx + gunicorn, however, I would like to handle graceful database failures. For example, if the ORM cannot query the database I would like to return a custom error message. ==> gunicorn.log <== [2017-06-07 06:06:01 +] [13] [DE

Re: ImageField filename

2012-01-27 Thread Damian Soriano (Gmail)
You can define a function that returns the path to upload the image, in this function you receive as argument the object being saved (instance) and the name of the file (filename). You can return whatever you want as a path (that include the filename) def upload_path(instance, filename): retur

Re: two different models, order by date

2010-02-24 Thread Damian
>> > objects from both models and order them by date, getting result_set >> > that >> > might look like this: >> >> > movie1 >> > movie2 >> > book1 >> > movie3 >> > book2 >> >> > is this possible? >> > if

Overiding model's save() while saving models of the same types

2008-06-10 Thread Mihai Damian
I need to modify models of the same type as the model I'm saving. I tried overriding the save method but I get a concurency error (I think) when I save the other model objects of same type. Can this be done or should I consider a (long) workaround? Thanks --~--~-~--~~~

Re: ModelChoiceField option values

2008-06-10 Thread Mihai Damian
10x, I eventualy solved the problem. I think I was doing some caching and so the values didn't resemble the id's I was reading from the database --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

ModelChoiceField option values

2008-06-07 Thread Mihai Damian
I'm using a ModelChoiceField on a form and it seems the value attributes of the generated option tags are simply their numeric order in the queryset. How can I set the value attribute to some useful information like id or the __unicode__ representation itself? Thanks --~--~-~--~~-

@user_passes_text question

2008-06-05 Thread Mihai Damian
Can the function called by @user_passes_text get any extra argument except user? Like request maybe?! I'm thinking of using the decorator on a view function but I need variables from request to determine if the user is granted access or not. Thanks --~--~-~--~~~---~--~

Re: admin documentation field description

2008-06-01 Thread Mihai Damian
I see that verbose_name is also an interesting option --~--~-~--~~~---~--~~ 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 g

Re: admin documentation field description

2008-06-01 Thread Mihai Damian
Ok, this is what I was looking for. It doesn't allow me to completly override the description, instead it just appends my text but I guess it's good enough. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dja

admin documentation field description

2008-06-01 Thread Mihai Damian
In the admin interface users can browse documentation related to models and such, using the documentation link. I see that every field can have a description there. However the model definition chapter in djangobook says nothing about adding description to fields. Does anyone now how I can change

Re: Adding new language for i18n

2008-04-25 Thread Mihai Damian
Ticket opened here: http://code.djangoproject.com/ticket/7084 --~--~-~--~~~---~--~~ 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 fr

Re: Adding new language for i18n

2008-04-24 Thread Mihai Damian
So new lines on blocktrans tags get a \r\n on Windows as opposed to just \n on Linux. That's what's causing the whole problem. Maybe the make-messages.py could be modified to check if os.name is nt or os2 and if so read the target file, replace \r with '', write the new content to a temporary file

Re: Adding new language for i18n

2008-04-24 Thread Mihai Damian
Not shure yet but this could be a Windows only issue. I'll get back later with some tests. --~--~-~--~~~---~--~~ 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: Adding new language for i18n

2008-04-24 Thread Mihai Damian
Hi, I'm also trying to update the .po for Romanian. I was runing make- messages.py -l ro to update the .po and got the same error as chatchai. I presume this is a bug in bookmarklets.html, right? Thanks Mihai --~--~-~--~~~---~--~~ You received this message becau

multiple appearance of a block

2008-04-03 Thread Mihai Damian
I'm trying to declare two identical blocks in a template that I'm extending from other templates. This throws the TemplateSyntaxError. Any ideea on how I can get arround this? I can think of a couple of examples when it would be useful to repeat a block in a template. Thanks --~--~-~--~--

javascript shortcuts on django templates

2008-02-08 Thread Mihai Damian
I'm following the official Django tutorial for ver 0.96. I got to the part where the admin pages are generated and noticed that none of the javascript helpers mentioned in the tutorial get displayed on my pages (the date - time control, or the show link for collapsible fields, etc.). I use 0.96.1