My Django project is going to be backed by a large database with several hundred thousand entries, and will need to support searching (I'll probably end up using djangosearch or a similar project.)
Which database backend is best suited to my project and why? Can you recommend any good resources for further reading?
...
I have a very basic CSV file upload module working to bulk upload my user's data into my site. I process the CSV file in the backend with a python script that runs on crontab and then email the user the results of the bulk upload. This process works ok operationally, but my issue is with the format of the csv file.
Are there good to...
I'm looking to do something like this:
http://stackoverflow.com/questions/160009/django-model-limitchoicestouser-user
with some differences.
Some models may explain:
class Job(models.Model):
name = models.CharField(max_length=200)
operators = models.ManyToManyField(User)
class Activity(models.Model):
job = models.Foreign...
Is it possible to set the default sort order for a model to a field from a related model (rather than the integer key) i.e. something that yields a SQL order by clause with a field from both models? If so, how? I can do this via query_by but I can't figure out how to set it by default. Thanks.
class Foo(models.Model):
name = models....
Django has a very handy pattern known as "apps". Essentially, a self-contained plug-in that requires a minimal amount of wiring, configuring, and glue code to integrate into an existing project. Examples are tagging, comments, contact-form, etc. They let you build up large projects by gathering together a collection of useful apps, ra...
[Django 1.0.2]
I have a view set up like this:
(r'^redirect/(?P<object_id>\d+)/(?P<url>.*)/$',
'django.views.generic.simple.redirect_to',
{'content_type': SiteType}, 'clickout'),
When I get the following URL, two different things happen on local development server and on remote mod_wsgi server:
# GET
"/redirect/2/http://www....
I have these two simple models, A and B:
from django.db import models
class A(models.Model):
name = models.CharField(max_length=10)
class B(A):
age = models.IntegerField()
Now, how can I query for all instances of A which do not have an instance of B?
The only way I found requires an explicitly unique field on each subclass, wh...
Hi fellow stackers,
I'd like to ask about the most elegant approach when it comes to designing models with virtual fields such as below in Django...
Let's say we're building an online store and all the products in the system are defined by the model "Product".
class Product(models.Model):
# common fields that all products share
...
I want to let a logged-in and registered user create extra user accounts that he will be the admin of. These accounts will be special "subordinate" accounts that are tied to the user creating them. He should be able to add/modify/delete these accounts kind of like the theory of how a Google apps administrator manages the accounts for h...
Every now and then, you have the need to rename a model in Django (or, in one recent case I encountered, split one model into two, with new/different names). Yes, proper planning helps to avoid this situation, but sometimes reality intervenes.
After renaming corresponding tables in the db and fixing affected code, one problem remains: ...
Help please with a django custom tag. Analize it please!
Idea:
In any template (parent or child), we installing a tag {{ telepoint "head" }}, with a name, such putters could be more than one.
At other side, we have block
{{ teleputter "head" "unique-name" }} some html {{ teleputterend }}
Content of this block goes to telepoint wit...
The "main" one should be IIS. Is there an option to address the Apache without typing in the port-number
The reason for this is: I cannot get Django to work on IIS
Any ideas will be appreciated
...
class Person(models.Model):
name = models.CharField(max_length=100)
class Entry(models.Model):
text = models.CharField(max_length=100)
person = models.ManyToManyField(Person, blank=True, null=True)
class MyModelForm(forms.ModelForm):
class Meta:
model = Entry
In my view, I need to add pk id's to a submitted fo...
I just built a small application(using Django) which will accept any jobseeker resumes. So any jobseeker uploads his/her resume in the form provided. How do I test this using testcases. I am used to writing fixtures for my initial data using json files. How would I have the same sort of a thing with doc files? So simply I want to run my ...
I've been applying Django's automatic administration capabilities to some applications who had previously been very difficult to administer. I'm thinking of a lot of ways to apply it to other applications we use (including using it to replace some internal apps altogether). Before I go overboard though, is there anything in particular ...
I have a view that accepts a form submission and updates a model.
After updating the model, I want to redirect to another page and I want a message such as "Field X successfully updated" to appear on this page.
How can I "pass" this message to the other page? HttpResponseRedirect only accepts a url. I've seen this done before on othe...
I'm still getting to grips with Django and, in particular, Forms.
I created MyForm which subclasses forms.Form in which I define a field like this :
owner = forms.CharField(widget=forms.HiddenInput)
When I create a new, blank instance of the Form I want to prefill this with the creator's profile, which I'm doing like this :
form = My...
I would like to do:
{% if appnav %}
<hr />
<div id="appnav">
<ul class="tabs">
{% block appnav %}{% endblock %}
</ul>
</div>
{% endif %}
...however, testing for the present use of a block by templates further down the inheritance chain doest seem to work.
Is there some other conditional that might do this?
...
I want to create a floor plan map of an interior space that has clickable regions. My first thought was to investigate GeoDjango since its the mapping app for Django. But considering the dependencies, the learning curve and overall complexity, I'm concerned that I may be trying to swat a fly with a bazooka.
Should I use GeoDjango for ...
I am working on ajax-game. The abstract: 2+ gamers(browsers) change a variable which is saved to DB through json. All gamers are synchronized by javascript-timer+json - periodically reading that variable from DB.
In general, all changes are stored in DB as history, but I want the recent change duplicated in memory.
So the problem is:...