I want to have a model with a ManyToMany relationship with itself, I don't know how to write this but I'l try to write some code to illustrate what I want to do.
class Person(models.Model):
name = models.CharField()
occupation = models.CharField()
fiends = models.ManyToManyField('self', through = PersonFiends)
My Model that ...
I'm using Netbeans for coding Django. When I insert:
import ipdb; ipdb.set_trace()
Flow execution gets stopped but it shows gibberish, such as:
[1;32m/path/to/file/models.py[0m(344)[0;36macceptBid[1;34m()[0m
[1;32m 343 [1;33m [1;32mimport[0m [1;37mipdb[0m[1;33m;[0m [1;37mipdb[0m[1;33m.[0m[1;37mset_trace[0m[1;33m([0m[1;33m)...
I have successfully created my first django project.
I have two apps in my project foo and foobar.
I have created a folder named 'fixtures' in each of the app folders. I have NOT specified a fixtures directory in my settings.yml, so (according to the docs), django should be looking in my {app}/fixtures folder.
In the {app}/fixtures fo...
I'm still stuck with the inline Tree-like-eiditing of related models on same page.
I've got three models, A, B and C.
Class A
Class B
fb = foreignkey(A)
Class C
fc = foreignkey(B)
In admin.py I'm doing something like
AdminA
inlines = [inlineB]
AdminB
inlines = [inlineC]
I want that when I edit/add model A, I sh...
Hello, I am having problem in django. I have created a form in my app where I can take details of a client. Now I want to create a form which can allow me to edit a form. However I am having some problems when I go to /index/edit_client/1, I get this error.
local variable 'form' referenced before assignment
I do not know what the reas...
Can wget be used to get all the files on a server.Suppose if this is the directory structure using Django framework on my site foo.com
And if this is the directory structure
/web/project1
/web/project2
/web/project3
/web/project4
/web/templates
Without knowing the name of d...
Hey,
Does Django hit the database again when making queries following relationships backwards using the FOO_set manager? I thought I read somewhere that it does not but I can't find it in the docs anywhere.
J
...
Hi,
I've got a django app whose views currently use the @login_required decorator.
What's the easiest/best way to add extra logic to the login system? I want to add extra constraints such as that their subscription to the site is still valid. If it has expired I want to direct them to a page that says their subscription has expired and...
Could someone tell me how I can run Django on two ports simultaneously? The default Django configuration only listens on port 8000. I'd like to run another instance on port xxxx as well. I'd like to redirect all requests to this second port to a particular app in my Django application.
I need to accomplish this with the default Django ...
Hello,
I work in the django IPython-shell, which can be started with manage.py shell.
When i load an extern function in the shell for testing, everything is alright. But when i make changes to the function, the shell still has the old version of the function. Even if i make a new import.
Does anyone know how to reload the actual versio...
I'm having a hard time wrapping my head around this Django query. I could probably figure this out with SQL (and maybe I'll have to), but I was wondering if there is a way to do it with Django objects.
The model looks something like this (simplified for clarity):
class Stat(model.Models):
entry_date = models.DateTimeField()
qua...
I'm trying to make django work with wsgi in a shared hosting, so I cannot access server logs,
I'm trying to redirect the output to a file in my django.wsgi script, like this:
saveout = sys.stdout
log_out = open('out.log', 'w')
sys.stdout = log_out
but this is the error that I have (in the only error log that I can access)
[Thu Oc...
I'm ultimately trying to validate a FileField by extension type. But I'm having trouble even getting the clean method for this field to pickup the POSTed value.
from django.forms.forms import Form
from django.forms.fields import FileField
from django.forms.util import ValidationError
class TestForm(Form):
file = FileField(r...
I'm using django-uni-form to display forms. I've included all the css and javascript (notably jquery) in the page. But now I get some weird looking lines. The image below show how it looks:
http://i243.photobucket.com/albums/ff176/cwalkrox/uni-form1.jpg
You can notice that for username and email address, the lines are aligned with the ...
I want to develop an application which uses Django as Fronted and Celery to do background stuff.
Now, sometimes Celery workers on different machines need database access to my django frontend machine (two different servers).
They need to know some realtime stuff and to run the django-app with
python manage.py celeryd
they need acc...
This is more of a best-practices question, and given that I'm quite tired it mightn't make much sense.
I've been putting together a blog app as a learning experience and as an actual part of a website I am developing.
I've designed it like most apps so that you can list blog posts by multiple criteria i.e.
/blog/categories/
/blog/au...
Hi,
I'm helping build a multilingual website in English, Chinese and French (after in Spanish, Korean and Arabic). I've collected a database of over 2000+ entries. It is essentially a huge product catalog (specifically travel packages) where more or less the info is the same (prices, sizes, numbers, etc.) but the labels change (of cour...
I've got two forms on one page. If a user selects a certain option on one form, I want to make an option on the other form no longer required. How can I do that? I don't think I can put the logic in the clean method because they're separate forms.
...
Hello,
I have recently been come to for advise on an idea of rewriting an existing site due to massive maintenance problems in their old design.
Basically, the company is considering a complete rewrite of aprox. 90% of their site which is currently written in PHP using an in-house framework.
The company would like to rebuild the backen...
I'm using a customized version of Hacker News popularity algorithm for my social site (items with a number of likes and comments). The algorithm works perfectly but I don't know how to update item scorings correctly (I'm storing the score in item model as meta data).
Now I'm just updating scores on every new like and comment for items ...