I am using "manage.py test" along with a JSON fixture I created using using 'dumpdata'
My problem is that several of the tables in the fixture are very large (for example one containing the names of all cities in the US) which makes running a test incredibly slow.
Seeing as several of these tables are never modified by the program (eg...
How can you check the type of a many-to-many-field in django?
I wanted to do it this way:
import django
field.__class__ == django.db.models.fields.related.ManyRelatedManager
This doesn't work, because the class ManyRelatedManager can't be found.
But if i do field.__class__ the output is django.db.models.fields.related.ManyRelatedManager...
I am developing a website which is aimed at being a GUI for several image processing algorithms (referred to as 'tasks').
At the moment, only one of these algorithms is finished, but there are more to come (which will have a similar, but not quite the same, workflow)
Basically, the algorithm works as follows (not that it matters a lot,...
What is the easiest way to generate list view for a model, with clickable headers and search (filter) field, more-or-less like the admin site? I read a bit about generic views, but I don't see a simple solution there.
...
Is there a way to test the html from the response of:
response = self.client.get('/user/login/')
I want a detailed check like input ids, and other attributes. Also, how about sessions that has been set? is it possible to check their values in the test?
...
Hello,
I have to show entries by date in a django app and i'm a bit blocked :
Here's an example of my models:
class Event(models.Model):
name = models.CharField(max_length=100)
theme = models.ForeignKey(Theme)
...
class Date(models.Model):
event = models.ForeignKey(Event)
start = models.DateField()
en...
Django 1.1.1
Models.py:
class Datapoint(models.Model):
parameter1 = models.FloatField()
parameter2 = models.FloatField()
I want to bin the values of parameter1 to the nearest integer (or other rounding), and then return the average of the two parameters for this bin.
In SQL I would do the following:
select round(parameter1,...
I'm trying to get the related_name of a many-to-many-field. The m2m-field is located betweeen the models "Group" and "Lection" and is defined in the group-model as following:
lections = models.ManyToManyField(Lection, blank=True)
The field looks like this:
<django.db.models.fields.related.ManyToManyField object at 0x012AD690>
T...
My place of employment requires that all passwords must be encrypted, including the ones used to connect to a database. What's the best way of handling this? I'm using the development version of Django with MySQL at the moment, but I will be eventually migrating to Oracle. Is this a job for Django, or the database?
Edit: The encrypted p...
Since I have Django 1.1x on my Debian setup - how can I use virtualenv or similar and not have it mess up my system's default django version which in turn would break all my sites?
Detailed instructions or a great tutorial link would very much be appreciated - please don't offer vague advice since I'm still a noob.
Currently I store al...
I have a Django radio button group that renders to HTML as follows:
<ul>
<li><label for="id_package_id_0"><input type="radio" id="id_package_id_0" value="1" name="package_id" /> Test 256</label></li>
<li><label for="id_package_id_1"><input type="radio" id="id_package_id_1" value="2" name="package_id" /> Test 384</label></li>
<li><label ...
I read about this issue already, but I'm having trouble understanding why I can't change the value of a form's field during validation.
I have a form where a user can enter a decimal value. This value has to be higher than the initial value of the item the user is changing. During clean(), the value that was entered is checked against t...
I am getting the following error:
Traceback (most recent call last):
File "../tests.py", line 92, in test_single_search
for return_obj in serializers.deserialize("json",response, ensure_ascii=False):
File "/Library/Python/2.6/site-packages/django/core/serializers/json.py",
line 38, in Deserializer
for obj in PythonDe...
I have an existing Perl app that I'm moving to a Webfaction website. I will be adding Django apps to this Webfaction website too.
I would like the Django app to get first call and so would want its URL path to be /
This would allow me to add any new URLs to the urls.py I wish as my app grows.
If the URL doesn't match anything in the u...
I'm trying to create a Django app that would take an inputted address and return a list of political races that person would vote in. I have maps of all the districts (PDFs). And I know that I can use geopy to convert an inputted address into coordinates. How do I define the voter districts in Django so that I can run a query to see what...
I'd like to be able to use a customized form in a modelformset_factory. For example:
models.py
class Author(models.Model):
name = models.CharField()
address = models.CharField()
class AuthorForm(ModelForm):
class Meta:
model = Author
views.py
def test_render(request):
myModelFormset = modelformset_factory(Aut...
I have the following models:
class Foo(models.Model):
field1 = models.IntegerField()
...
class Bar(models.Model):
field1 = models.IntegerField()
...
class Foo_bar(models.Model):
foo = models.ForeignKey(Foo)
bar = models.ForeignKey(Bar)
...
In the admin, I want it so that in the Foo change/add page, you ca...
Say I have a table 'People', is there a way to just quickly check if a People object exists with a name of 'Fred'? I know I can query People.objects.filter(Name='Fred'), and then check the length of the returned result, but is there a way to do it in a more elegant way?
...
I have a model with a JSON field or a link to a CouchDB document. I can currently access the dynamic informaction in a way such as:
genericdocument.objects.get(pk=1) == genericdocument.json_field['sample subfield'] instead I would like genericdocument.sample_subfield
to maintain compatibility with all the apps the project currently sh...
Hi,
Creating a web application (Django in my case, but I think the question is more general) that is administrating a cluster of workers doing queued jobs, there is a need to track each jobs progress.
When I've done it using database UPDATE (PostgreSQL in this case), it severely hits the database performance, because each UPDATE create...