I have written my functions as méthods of classes. Then it allow to
use inheritance.
Le 11 avr. 2010 à 05:58, ydjango a écrit :
I find all my view method have identical code in start and in end:
anyway to avoid repetition...?
Example:
def typical_view_method(request):
Check if user i
Django provides a few decorators that remove alot of that repetitive code.
Check the auth section for the logged in decorator
Vitaly Babiy
On Sat, Apr 10, 2010 at 11:58 PM, ydjango wrote:
> I find all my view method have identical code in start and in end:
>
> anyway to avoid repetition...?
>
I find all my view method have identical code in start and in end:
anyway to avoid repetition...?
Example:
def typical_view_method(request):
Check if user is authenticated.
Get user and group
Get some session variables
try:
Method specific logic
except Exception, e:
Hi there,
I have a request.session['querySoFar'] variable that I'm appending a Q
object to with each POST in order to build up a final query to run.
However, this session var is getting cleared out sometimes. I have no
idea why this is happening. I do not believe that I am resetting like
so:
Try this for a solution
http://stackoverflow.com/questions/2536285/django-formset-management-form-validation-error
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscrib
Hi,
today I've noticed that my LogEntry change messages output the name of
the field and do not respect when it has verbose_name setup (which is
translated).
I've had a look at admin.options.construct_change_message(), the line
responsible is:
change_message.append(_('Changed %s.') %
get_text_li
Scratch that. I ended up doing it the other way. I went back and
reviewed and it seemed less ugly now than it did at midnight last
night. Funny, that. Thanks for the advice.
On Apr 10, 10:45 am, Laereom wrote:
> Honestly, I really don't like that method, mostly due to ugliness.
> I'm looking
Honestly, I really don't like that method, mostly due to ugliness.
I'm looking for a solution specifically to instantiating a form
created via a class factory, unless that is some sort of Herculean
task.
On Apr 10, 10:13 am, Daniel Roseman wrote:
> On Apr 10, 4:40 pm, Laereom wrote:
>
>
>
>
>
>
I forgot to mention: I'm using Django 1.0 on Ubuntu.
On Apr 9, 10:41 pm, adambossy wrote:
> I have created users for my unit tests in two ways:
>
> 1) Create a fixture for "auth.user" that looks roughly like this:
>
> {
> "pk": 1,
> "model": "auth.user",
> "fields": {
On Apr 10, 4:40 pm, Laereom wrote:
> As the title suggests, I'm creating a dynamic form via a class
> factory.
>
> Here is what I'm doing inside the class factory itself (as far as
> actually making the class goes):
> class _QuestionAnswerForm(forms.Form):
>
Hallöchen!
Wiiboy writes:
> [...]
>
> 2. Regarding documentation, the docs at
> http://docs.djangoproject.com are, in my opinion, simply amazing.
> By far the best documentation for a free project that I've seen
> (but then again, I haven't seen much). [...]
They are great. Really great. And
As the title suggests, I'm creating a dynamic form via a class
factory.
Here is what I'm doing inside the class factory itself (as far as
actually making the class goes):
class _QuestionAnswerForm(forms.Form):
response =
forms.IntegerField(widget=RadioSelect
I'm a bit of a noob as well, and know nothing about Rails, but I'd
like to comment on a few issues you mentioned.
1. Non-existent template variables are replaced with the value of the
TEMPLATE_STRING_IF_INVALID setting. Set that to something besides its
default (an empty string) to make non-exis
This can work when you know you want to use the object once it's been
retrieved. If all you want to do is check for existence then it's
better to do the check with a:
if Class.objects.filter(pk=pk).count() == 0:
# Do object doesn't exist stuff
else:
# Do object does exist stuff
--
G
On
I dump datga:
./manage.py dumpdata --format=yaml appname > initial_data.yaml
The result is:
- fields: {description: "\u0423\u043A\u0440\u0430\u0438\u0301\u043D
\u0430 (\u0443\
\u043A\u0440. \u0423\u043A\u0440\u0430\u0457\u043D\u0430
[ukr\u0251\u02C8\
How to configure django to save
Hi all,
I want to provide automatically loaded initial data for the third
party app - 'django-tagging'. There is a special place for internal
apps: /fixtures/initial_data.yaml, but not for a third
party.
I want data to bi initialized on ./manage.py syncdb
There are many similar questions:
http:
Hello everybody
I have a model with self reference foreign key :
class Categories(Model.model):
category = Model.CharField(...)
parent_category = Model.ForeignKey(self, ...)
url = Model.CharField()
an i want to remove items from this table given the url of a category
this is a p
Hi all,
I am having two tables say TableOne and TableTwo and below are some of
the fields of these tables
TableOne:
companyName
Tabletwo:
companyid (i am saving key().id() of TableOne in it)
now i have to filter TableOne contents which are not in TableTwo.
i.e. i want list of companies which doe
On Apr 9, 10:54 pm, Joakim Hove wrote:
> Hello,
>
> I have something I would presume was a very common pattern. I have a
> view which gets a primary-key (from the user) as second argument:
>
> def my_view( request , pk ):
> obj = Class.objects.get( pk = pk)
> # Do something with obj and
On Apr 10, 8:30 am, Kevin Teague wrote:
> There is nothing exceptional about exceptions in Python. McDonc does a
> good job at explaining how to think about exceptions as less than
> exceptional:
>
> http://plope.com/Members/chrism/exceptions_arent_errors/view
>
> The only arguably exceptional par
okay, it actually wasn't that hard.
just in case anyone faces the same situation here the solution that
works for me:
tickets.extra(select={'has_deadline': "CASE WHEN myDeadline IS NULL
THEN 1 ELSE 0 END"}).order_by('has_deadline','myDeadline')
--
You received this message because you are subs
21 matches
Mail list logo