Just added geoDjango and moved the database over to PostGIS. I have a bunch of Unit tests that pass individually, but when run together I get an IntenalError the database being grumpy between the tests. The model that's getting used in these tests is a django.contrib.gis.db model. The tests even inherit from TransactionTestCase instead o...
Hello, I have a weird problem, I want to add a global query using context processors.
This is how I did it by following:
made a processor.py in my app as such:
from myproject.myapp.models import Foo
def foos(request):
return {'foos': Foo.objects.all()}
and at the end of my setting.py I have added this:
TEMPLATE_CONTEXT_PROCESS...
Say I have a model with a foreign key to a Django Auth user:
class Something(models.Model):
user = models.ForeignKey(User, related_name='something')
I can then access this model through a RelatedManager:
u = User.objects.create_user('richardhenry', '[email protected]', 'password')
u.something.all()
My question is, if I creat...
I have this:
Class A(models.Model):
name = models.CharField(max_length=50)
Class B(models.Model):
a = models.ForeignKey(A)
class C(models.Model):
a = models.ManyToManyField(A)
When i need the attribute a in an object of C:
related_manager = getattr(object_c,'a')
and this give me a ManyRelatedManager but the proble...
(Please let me know if this is completely absurd, that is probably a reason why I haven't found anything on this.)
This story has two models Ranking and Artist, Ranking is generically related to Artist (object_id, content_type... the whole shebang).
I have a list of objects returned by Ranking.objects.values_list() ordered by a certain...
This view is running fine on plain pyton/Django/mysql on Windows
I'm porting this to run over jython/Django/mysql and it gives error -
Exception received is : error setting index [10] [SQLCode: 0]
Parameter index out of range (10 > number of parameters, which is 0). [SQLCode: 0],
[SQLState: S1009]
The Query is -
cursor.execute(...
Can a field of type models.PositiveIntegerField contain a 0 value? I'm doing something like:
points = models.PositiveIntegerField(default=0)
Thanks,
I know I should try ir myself, but I haven't a Django environment here.
...
I know how to use it for CharField.
...
I need to implement full text search for my Django application, running MySQL as backend.
Let's say I've got a model as follows:
class MyItem(models.Model):
title = models.CharField()
short_description = models.TextField()
description = models.TextField()
I would like to have results first for search term occurences in ti...
I have web pages that take 10 - 20 database queries in order to get all the required data.
Normally after a query is sent out, the Django thread/process is blocked waiting for the results to come back, then it'd resume execution until it reaches the next query.
Is there's any way to issue all queries asynchronously so that they can be ...
Let's say I have 3 django apps, app Country, app Social and app Financial.
Country is a 'master navigation' app. It lists all the countries in a 'index' view and shows details for each country on its 'details' view.
Each country's details include their Social details (from the social app) and their Financial details (from the financia...
I'm going to be away from internet access sporadically, and I'd like to continue learning Django 1.0 using the Django book. I have found a PDF of version 1.0, but that deals with an older version of the framework, and so I expect it to differ in subtle and hard-to-grok ways from the version I'm working with.
Is there a PDF/ePub/HTML off...
Hi everyone,
Our website uses a PHP front-end and a PostgreSQL database. We don't have back-end at the moment except a phpPgAdmin. The database admin has to type data into phpPgAmin manually, which is error-prone and tedious. We want to use Django to build a back-end.
The database has few dozens of tables already there. Is it possible ...
root url.py:
(r'^hhhh/',include('hhhh.urls')),
hhhh urls.py:
from django.conf.urls.defaults import *
urlpatterns = patterns('hhhh.views',
url(r'^$', 'h_view', name="hhhh_list"),
url(r'^read/^$', 'read', name="read_name"),
url(r'^write/$', 'write', name="write_name"),
)
view:
def h_view(request):
return render_to...
I'd like to use simplejson to serialize a Django model. Django's serializer doesn't support dictionaries... and simplejson doesn't support Django Querysets. This is quite a conundrum.
In the model there's sponsors that have a Foreign Key to sponsor level, I'm trying to group all the sponsors that belong to a certain sponsor level togeth...
Hello,
I'm writing a small Bittorrent tracker on top of the Django framework, as part of a larger project. However, I'm having problems with decoding the "info_hash" parameter of the announce request.
Basically, uTorrent takes the SHA1 hash of the torrent in question and URL encodes the hex representation of it, which is then sent to t...
i made a pinax basic_project,and i found this in settings.py:
LANGUAGE_CODE = 'en'
and my pinax is not only en :
why ???
thanks
...
Hi,
Is it possible to have a field in a Django model which does not get stored in the database.
For example:
class Book(models.Model):
title = models.CharField(max_length=75)
description models.CharField(max_length=255, blank=True)
pages = models.IntegerField()
none_db_field = ????
I could then do
book = Book.objects....
I was watching a video coding html, and I saw in the video they used a bit of code that looked like this:
<body>
{% block %}
{% endblock %}
</body>
Is this some form of commenting in html? I think the coder they were using was Espresso for Mac. I've just never seen it.
The video is here:
http://vimeo.com/7405114, at about 5 m...
First, the code of my tests.py
def test_get_current(self):
m = Member.objects.create(...)
q = Question.objects.create(name="q1", text="q1", start_datetime=self.day_before, close_datetime=self.day_after, type=self.type)
r = Response.objects.create(question=q, text='response')
expected = q, None
#self.assertEquals(exp...