django

how to serve PHP together with Django?

i have a Bluehost hosting account, and i manually configure django with this tutorial, but now i need to run php scripts into a subdomain or in subfolder, how can i do that? my root .htaccess look like this AddHandler fcgid-script .fcgi # For security reasons, Option followsymlinks cannot be overridden. #Options +FollowSymLinks Options...

Make django admin logEntry read only?

I found this post and it was very useful, but i need put the logEntry model into read-only in the admin interface, its that possible? thanks and sorry for my english! ...

Python Unicode ajax form posting error

Hey, i got a n00b problem with python and i've been searching here for a while and i couldnt find a proper solution... i got a utf8 form that i ajax post to a python page. i read the json simplejson with utf-8 charset. the text is fine as long as there is no mixed utf8 and latin chars like ?!;, etc... UnicodeDecodeError: 'ascii' codec...

Django: vibrant community and future?

I'm in that horrible questioning state. No, not trying to figure out if I'm gay. I'm trying to decide between Django and Rails. From what I've read, Django probably fits my needs better, both from a "cultural" and goal point of view. The baked-in admin interface pretty much sells me alone. However, I have one critical concern: it look...

how to make dynamically generated forms with one to many relationships in django

i am trying to write a quiz system to learn django where users can add quizes to the system. my models look like from google.appengine.ext import db class Quiz(db.Model): title=db.StringProperty(required=True) created_by=db.UserProperty() date_created=db.DateTimeProperty(auto_now_add=True) class Question(db.Model): question=db....

Django for a simple web application

I'm developing an app (an API) in python and I would like to offer some of its functionality through a web interface (like web services do). I've been looking at django, but I don't know if really fits well in my idea. I only want to create a web page that invokes to my API methods in order to acomplish the functionality that offers th...

django-admin.py is not working properly

I have just spotted that something is wrong with my django-admin.py command. I checked similar SO posts on django-admin.py problems but nothing seems to be related to my problem. I use Windows Vista (yeah, I know...). I also have many versions of django in some folder on my disk and I switch to the version I need using junction command (...

How to make an auto-filled and auto-incrementing field in django admin

[Update: Changed question title to be more specific] Sorry if I didn't make the question very well, I can't figure how to do this: class WhatEver(): number = model.IntegerField('Just a Field', default=callablefunction) ... Where callablefunction does this query: from myproject.app.models import WhatEver def callablefunction(): ...

Remote execution of commands using the Django ORM

Can I somehow work with remote databases (if they can do it) with the Django ORM? It is understood that the sitting has spelled out the local database. And periodically to make connection to various external databases and perform any sort of commands such as load dump. ...

python request param

I m working on django view.I m posting a form which has a param name 'service'.Service is checkbox so it will have mulitple values.When i am getting the values of service in my code it is giving me only one value not the array.Here is my sample code {% for ser in allService %} <td > <input type="checkbox" name="service"...

Models does not create tables when synched

I have some django models for my extended users profile. Problem is that this code does not create tables when syncdb is used (simply nothing happens. No validation errors). Why is that happening? (Also those models give import error elsewhere) : #!/usr/bin/env python # encoding: utf-8 from django.db import models from django.contrib.au...

django delete object

Hello, in a mini blog app, i want to create a delete function, so that the owner of the blog can delete his entries (and only his entries). I guess that the only methos for doing do, is using a form. Though my the deletion code seems clear and correct, it doesn;t work. My code: def delete_new(request,id): u = New.objects.get(pk=id).d...

django on windows server 2008

does djanog work on windows server 2008? ...

How to order by aggregate with conditions on fields of a relation

My code: class School(models.Model): pass class Student(models.Model): school = models.ForeignKey(School) TYPE_CHOICES = ( ('ug', 'Undergraduate'), ('gr', 'Graduate'), ('al', 'Alumnus'), ) type = models.CharField(max_length=2) How do I obtain a QuerySet of Schools ordered by the number of Under...

Should a modifying class method save itself or be explicity called after the method is called?

Suppose a class has a method that modifies it's internals. Should that method call save on itself before returning or should the save be left to the caller to explicitly save after the modifying method has been called? Example: Explicitly calling save: class Bar(models.Model): def set_foo(self, foo): self.foo = foo bar = ...

Conditional inline in Django admin?

I'm trying to figure out a way to display the following RelativeInline only if Person.is_member is True. Current admin.py: class RelativeInline(admin.TabularInline): model = Relative fk_name = 'member' class PersonAdmin(admin.ModelAdmin): inlines = [RelativeInline,] ordering = ('first_name',) list_filter = ('is_me...

Django can you receive signals in middleware or alter the response object globally?

I'd like to call a function in my view or any module for that matter and have it update the response body. My initial thinking is to implement a process_response middleware to update the response body, and set up a callback that receives signals sent in my function calls, but when I try, the receiver never fires (I've tested the singal/...

URLs and side effects (Django)

I'm wondering if it's considered okay (particularly, in Django) to have a URL that's only intended for actions with side effects, that's only intended to be accessed by POST, and that is basically invisible to the user. Let's say, for the sake of making this concrete, I have a little messaging system on my site, and from their inbox, a u...

Returning values from methods in Django

Hi! So, time for a newbie question but so utterly important since the documentation seems to have missed this very very basic example. All I'm trying to do is to return a value from a model to a view in Django. Here is some code. The model class Page(models.Model): def index(self): ex = 'foo string' return ex The vie...

Tricky Django GenericRelation query

Suppose I have a few models representing real life objects: "Person", "Chair", "Room" I also have a "Collection" model, which represents some collection of records of these models. Each model can be a member of more than on collection - therefore, I have also created a "Membership" model, which represents an object is a member of a co...