I have a Django based CMS that uses Django's sites framework and Nginx/Apache/mod_wsgi virtual hosts to run a number of websites on different domains. We're assessing other options for a Django stack and have the CMS running with a single site on a new server with Nginx proxying to Gunicorn (gunicorn_django, specifically).
Although this...
Django ContentTypes provides a GenericInlineFormSet, however the documentation does not explain how to use it, except for this test, which doesn't really explain it in a way I understand.
Please can you help me understand it?
Let's say I have the following classes
class Dog(models.Model):
name = models.CharField(max_length=64)
...
I want to create a rollback button in my django project using MySQLdb. I have tried to use commit() and rollback() with InnoDB as database engine, rollback() seems not work because the database was updated even though rollback() was put after commit(). Here is some related lines in python code:
def update(request):
if 'weight' in r...
I'm trying to change the behaviour of a Django model to allow me to access a foreign key's properties directly from the parent, e.g.
cache.part_number
vs
cache.product.part_number
I've tried overriding the __getattr__ method as follows, but I get a recursion error when I try to access the foreign key's properties
class Product(mo...
I have installed Django on Win7 and try
>>> import django
>>> django.VERSION
(1, 2, 3, 'final', 0)
it works. But when I call django-admin.py startproject myappname, Windows show me dialog with ask what program it should use to open this command. If I check python.exe then django-admin.py always show me help about django-admin.py
...
I am new to django and have gotten a bit stuck on trying to make the admin site work as I'd like it to. I am wondering if for making the admin functionality I want it is better to make a custom admin app with a template inheriting from admin/base_site.html, using the frontend login with a redirect when is_staff is true.
The initial d...
Hi all,
I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What I want is...
I'm on the cusp of starting work on a new webapp. Part of this will give users pages that they can customise in a one to many relationship. These pages naturally need to have unique URLs.
Left to its own devices, Django would normally assign a standard AUTOINCREMENT ID to a model. While this works fantastically, it doesn't look great an...
I'm monitoring the temperature for different locations. I have the data stored in a model and have set my views.py, but I would like to refresh the table every 5 minutes. I'm new to ajax and dajaxice, how can I write the function so it displays in html? this is my views.py:
def temperature(request):
temperature_dict = {}
for filter_...
Is there any naming convention for "created" and "last edit" dates in Django?
ie. in Symfony Framework this fields are named by default:
created_at
updated_at
...
Django when i send the following string from an ajax submit i get the following string in unicode.How to decode this
$.post("/records/save_t/",snddata,
function(data){
if(data == 0 ){
}
},"json");
In django
def save_t(request):
if request.method == 'GET':
qd = request.GET
elif request.method =...
I have the following models (simplified example):
class Book(models.Model):
users = models.ManyToManyField(User, through=Permission)
class Permission(models.Model):
user = models.ForeignKey(User)
role = models.ForeignKey(Group)
active = models.BooleanField()
book = models.ForeignKey(Book)
What I need is that for a Book instance ...
Hi there,
My application has a form with 2 submit buttons:
<input name="rating" class="Show" type="submit" value="Show answer">
<input name="rating" class="Skip" type="submit" value="Skip">
However I noticed some errors in GAE logs:
ValueError: invalid literal for int() with base 10: 'Voir la r\xe9ponse'
ValueError: invalid literal...
Is there a way to have reversible, named URLs for Django flatpages (or multilingual-ng, which is flatpages + translations)?
If not, is there a similar app available which can have named URLs for pages which are editable through the admin? (And I'd rather avoid any behemoth CMSs, please.)
...
Does anybody know, how to support i18n in forms ? I would like to use {% trans "SOMETHING" %} in a template. Or should I just use _() in views.py only for the selectbox, in order to translate these strings?
I do not want to use model i18n addons.
...
I have an interesting problem.
I have a very large (larger than 300MB, more than 10,000,000 lines/rows in the file) CSV file with time series data points inside. Every month I get a new CSV file that is almost the same as the previous file, except for a few new lines have been added and/or removed and perhaps a couple of lines have been...
How i know in server-side what authentication backend is for determinated user?
...
I currently have multiple Django sites running from one Apache server through WSGI and each site has their own virtualenv with possibly slight Python and Django version difference. For each site, I want to display the Python and Django version it is using as well as from which path it's pulling the Python binaries from.
For each Django...
I am developing an app for use on Google App Engine with Django and Google App Engine Django Helper.
A certain model is looking like this:
from appengine_django.models import BaseModel
from google.appengine.ext import db
from google.appengine.ext.db.djangoforms import ModelForm
class Server(BaseModel):
name = db.StringProperty(req...
Hi,
I'm trying to speed up my django unit test, so I wrote custom database backend using for test purposes another tablespace located in memory. But I found no real advantages, the time my test running in memory remains the same.
Then I created two similar tables using different tablespaces and run 10000 inserts for the each one. Time ...