Skip to content
Advertisement

Tag: django

Proper way to test Django signals

I’m trying to test sent signal and it’s providing_args. Signal triggered inside contact_question_create view just after form submission. My TestCase is something like: Is this the proper way to test this signal? Any better ideas? Answer I’ve resolved the problem by myself. I think that the best solution is following:

Aggregating save()s in Django?

I’m using Django with an sqlite backend, and write performance is a problem. I may graduate to a “proper” db at some stage, but for the moment I’m stuck with sqlite. I think that my write performance problems are probably related to the fact that I’m creating a large number of rows, and presumably each time I save() one it’s

What is the path that Django uses for locating and loading templates?

I’m following this tutorial on a Windows 7 environment. My settings file has this definition: I got the base_template from the template admin/base_site.html from within the default Django admin template directory in the source code of Django itself (django/contrib/admin/templates) into an admin subdirectory of myapp directory as the tutorial instructed, but it doesn’t seem to take affect for some reason.

Django datetime issues (default=datetime.now())

I have the below db model: I add a new instance by using the below: My issue: all records in database have the same value in date field, which is the date of the first payment. After the server restarts, one record has the new date and the other records have the same as the first. It looks as if

Change text_factory in Django/sqlite

I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a “wrapping layer”

How does Django save decimal values?

What am I doing wrong? I do something like that: count is the sum of all ratings of given MyModel and votes is an array of those ratings, their division gives an average rating for MyModel (sorry if I described it incorrectly due to my poor English). If i change previous to: Then ‘anything’ ends up in the database, but

Advertisement