django

Django Inherited Field Access

As of the most current version, Django does not allow a subclass to have a variable with the same name as a variable in its superclass, if that variable is a Field instance. I need a subclass to modify this variable, which I call 'department'. Calling my classes super and sub, I need sub to modify the department variable it inherits fr...

django filefield return filename only in template

I've got a field in my model of type FileField. This gives me an object of type type File, which has the following method: File.name: The name of the file including the relative path from MEDIA_ROOT. What I want is something like .filename that will only give me the filename and not the path as well something like: {% for download i...

Django. Acces request object from admin's form.clean()

My question is very similar to this one: http://stackoverflow.com/questions/1057252/django-how-do-i-access-the-request-object-or-any-other-variable-in-a-forms-clea Except, I have the same problem with admin form. So I can't see a way to init the form myself, therefore - to pass a request to it. Thanks beforehand. ...

How do you use Django forms when receiving JSON Ajax requests from an iPad?

I'm sending a lot of JSON requests from a native iPad application to my Django web server. How do I translate forms I use on my website to handle an iPad web service? Am I trying to solve the wrong problem, should a web service used from native iPad applications be redesigned to use REST-ful requests? ...

load base template passed on parameter

I have a site where different projects/programs are listed, the list is dynamic so once a user clicks on a specific program e.g. /program/health the template should load one that has a "health" specific header (mast head). How can I load a base template based on the program selected? ...

Django multi-language (i18n) and SEO

I am developing a multi-language site in Django. In order to improve SEO, I will give every language version a unique URL like below, english: www.foo.com/en/index.html french: www.foo.com/fr/index.html chinese: www.foo.com/zh/index.html However, Django looks for a "django_language" key in user's session or cookie to determine lang...

Can PyAMF support service deployment by way of the filesystem?

I'm evaluating PyAMF to replace our current PHP (ugh) AMF services framework, and I'm unable to find the one crucial piece of information that would allow me to provide a compelling use case for changing over: Right now, new PHP AMF services are deployed simply by putting the .php files in the filesystem; the next time they're accessed,...

Reload mod_fcgid without killing Python Service

Hi I'm currently running a Django project on my school's webserver with FCGI. I did follow the multiple guides that recommends installing a virtual local Python environment and it worked out great. The only issue i had was that "touching" my fcgi-file to reload source-files wasn't enough, but instead i had to kill the python service via...

admin panel recent actions

hello I was wondering if I can get django admin (logged as super user) to display in some kind of "recent actions box", changes other users (non super users) made? Thanx, Luka ...

Hide fields in Django admin

I'm tying to hide my slug fields in the admin by setting editable=False but every time I do that I get the following error: KeyError at /admin/website/program/6/ Key 'slug' not found in Form Request Method: GET Request URL: http://localhost:8000/admin/website/program/6/ Exception Type: KeyError Exception Value: Key 'slug' not fou...

Django Deploy trouble

Well, i've walking around this for a couples of days now... I think is time to ask for some help, i think my installation is ok... Server OS: Centos 5 Python -v 2.6.5 Django -v (1, 1, 1, 'final', 0) my apache conf: <VirtualHost *:80> DocumentRoot /opt/workshop ServerName taller.antell.com.py WSGIScriptAlias / /opt/workshop/...

how to use SQL wildcard % with Queryset extra>select?

I'm using the extra() modifier in a view. (See http://docs.djangoproject.com/en/1.1/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none ) Here's the the code: def viewname(request) ... exact_matchstrings=[] exact_matchstrings.append("(accountprofile.first_name LIKE '"...

Django: How can I get a block from a template?

Suppose my template has in it something like {% block subject %}my subject{% endblock %} and I load this template with tmpl = loader.get_template('mytemplate.html'), how can I extract "my subject"? ...

django/apache permissions problem

I'm running a django project on Centos 5.4 and serving it with httpd/mod_wsgi. I can't figure out the correct permissions for /home/website/django_project so that I don't get a 403 error. In my httpd.conf the user and group to run httpd as is apache. The group django is set up with website and apache as members. The owner of /home/web...

Django-admin.py not working (-bash:django-admin.py: command not found)

I'm having trouble getting django-admin.py to work... it's in this first location: /Users/mycomp/bin/ but I think I need it in another location for the terminal to recognize it, no? Noob, Please help. Thanks!! my-computer:~/Django-1.1.1 mycomp$ sudo ln -s /Users/mycomp/bin/django-admin.py /Users/mycomp/django-1.1.1/django-admin.py Pas...

Can't get python.manage.py syncdb to work

I just created my first django app, initialized variables DATABASE_ENGINE and DATABASE_NAME in settings.py, but now when I run python manage.py syncdb, I get the following error Can somebody help? Does this have to do with having two python versions installed? I'm a django/python noob, please help. thanks!! my-computer:~/Django-1.1.1 m...

Django: Serving Media Behind Custom URL

So I of course know that serving static files through Django will send you straight to hell but I am confused on how to use a custom url to mask the true location of the file using Django. http://stackoverflow.com/questions/2681338/django-serving-a-download-in-a-generic-view but the answer I accepted seems to be the "wrong" way of doing...

Is there a Railscasts for Django?

I learned everything I know about Rails from Railscasts. Now I want to learn Django but I'm not finding any comprehensive tutorial resources like Railscasts. Does an equivalent not exist in the Django world? If so, is that because there is less to learn? ...

MySQL efficiency as it relates to the database/table size

I'm building a system using django, Sphinx and MySQL that's very quickly becoming quite large. The database currently has about 2000 rows, and I've written a program that's going to populate it with another 40,000 rows in a couple days. Since the database is live right now, and since I've never had a database with this much information i...

Django generic relation field reports that all() is getting unexpected keyword argument when no args are passed.

I have a model which can be attached to to other models. class Attachable(models.Model): content_type = models.ForeignKey(ContentType) object_pk = models.TextField() content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") class Meta: abstract = True class Flag(Attachable): ...