django

facebook app django server connection

I am creating a Facebook app in Python + Django. I followed all the instructions mentioned on this page: http://wiki.developers.facebook.com/index.php/User%3APyFacebook%5FTutorial But it ended up giving me this error: The URL http://amitverma.dyndns.org/fbsample/?auth%5Ftoken=0e80c8dbba442763d2c539d6e64e992a is not valid. Please try aga...

Inlines Python/Django technique for objects

I am reading the source code of the Django application blog at git://github.com/nathanborror/django-basic-apps.git. How do you read the following Django code? {% tags_for_object object as tag_list %} My attempt: Make the variable object of the type *tags_for_object* and rename the variable to *tag_list*. The object apparently is bas...

How do add multiple fields to a Form when trying to validate data?

What is the best way to have the IP address be included with the Form is_valid. Let me start with some code examples. urls.py from django.conf.urls.defaults import * from testpost.views import TestPost urlpatterns = patterns('', (r'^djtestforms/', TestPost), ) model.py from django.db import models class TestPostModel(models.Mo...

Django bug with a tag

My code {% if GET['search'] % } {% block count codes|length as counter %} Is the following a valid if -clause as a Django tag? {% if GET['search'] % } The following code gives me an error that block takes only one argument. What is wrong in the code? {% block count codes|length as counter %} ...

What is the best way to store database settings with Django?

I'm attempting to write a browser game using Django but I'm getting a bit stuck on how to store the settings for the game. For example, the game is tick based and I want to store the current tick. I have decided that I want only one game per database to avoid problems with the built-in user authorisation system (e.g. I don't want to say ...

Django: Where to put helper functions?

I have a couple of functions that i wrote that I need to use in my django app. Where would I put the file with them and how would i make them callable whithin my views? ...

Django display value of extra field in modelform

How do I set the value of a field (which is relevant to form, but not based directly on the same model) on a (model) form when it is displayed in the admin? Here is a simplified version of what I have (my actual app/model/etc is more complicated): A building has many rooms A room has many pieces of equipment Models: #spaces/model...

Django admin: Can't add app to admin

I have installed Django on my host (I use their install version 1.1.1), all is working fine. I have created some apps and they are registered in my settings.py (I can verify this works when i visit the site, the app shows up). In the folder of this app i have created admin.py with the following content: from progmaticnet.page.models imp...

Django model ON DELETE CASCADE policy, emulate ON DELETE RESTRICT instead, general solution

I'd like to delete an instance of a model, but only if it doesn't have any other instance of another class with a foreign key pointing to it. From Django documentation: When Django deletes an object, it emulates the behavior of the SQL constraint ON DELETE CASCADE -- in other words, any objects which had foreign keys pointing at the ...

Django inlineformsetfactory - What is it good for?

Sorry for a newbie question but... Can someone shed some light on what is the use case for inlineformset_factory? I have followed example from Django documentation: #Models class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author) title = models.CharFi...

django chain select

django-smart-selects is an elegant solution that enables Django developers to have chained select inputs in their forms. But as reported by developers in its list of issues, it does not work well when used in formsets. The javascript it renders is tied to the id of the "chained field" right in the model definition. How do you think thi...

Django views not getting setting variables

Views.py is not picking up anything from settings.py views.py has import on top from django.conf import settings if tried to run in this file name = settings.APP_NAME it throws this error AttributeError at /test/app '_CheckLogin' object has no attribute 'APP_NAME' ...

On the google app engine, why does my 'import' statement fail on Live, but work on Dev(localmachine)?

I have a python/django application that runs on the google app engine. My views.py file has some imports... from commands.userCommands import RegisterUserCommand from commands.accountCommands import CreateNewAccountCommand, RenameAccountCommand These imports work fine on my development environment (local machine). But when I upload t...

Does Django support model classes that inherit after many non-abstract models?

Lets say I have three django model classes - lets call them A, B and C. If A and B are abstract, I can do something like: class C(A,B): pass What if they aren't abstract and I do the same? Will everything still work correctly or no? Or have I got it wrong and this should not be done with abstract models either? I'm having some is...

Error with Django User : "AttributeError: 'User' object has no attribute 'get' "

Hi, I've just started Django and Python 50 hours ago ;-) so this might be an easy one but I am stuck. I am using similar 'create' view with similar Form implementation in my project with no problem. In this case, I get the above mentionned error. I am using Pinax... 2 from django.shortcuts import render_to_response, get_object_or_40...

Filter zipcodes by proximity in Django with the Spherical Law of Cosines

I'm trying to handle proximity search for a basic store locater in Django. Rather than haul PostGIS around with my app just so I can use GeoDjango's distance filter, I'd like to use the Spherical Law of Cosines distance formula in a model query. I'd like all of the calculations to be done in the database in one query, for efficiency. A...

Python stack for data centric scalable REST application

What Python frameworks/libraries you would use to create a data centric REST application. The application will have the following traits: read-biased in terms of number of individual ad-hoc requests write-biased in number of records added in batch feeds scalable (think virtual appliance, cloud) variety of data formats such as csv files...

Is there a way to express Django admin settings inside the models, instead of admin.py?

Talking about Django 1.1.1. I thought at one time (0.96) the kinds of things put inside of the admin.py file were part of an inner class of the model. There's a certain beauty in having all of this in one place. But I don't know if this change was out of necessity. Any compelling reasons one way or the other? ...

Having trouble importing middleware classes in App Engine / Django

Trying to get facebook connect to work on app engine, and so I'm following these instructions: http://www.slideshare.net/mrtrosen/lab305-django-facebook-connect-integration-example One of the steps requires me to add to my middleware_classes, and so I've added the following to settings.py (copied from slide 18 in the presentation above...

Auth_token error at Facebook

i have been on this for the last 2 days with no result. i am running my facebook app on my localhost with port-forwarding method. i know my server setup is working fine as i can see the logs on the django runserver and dyndns log as well. django is properly responding to calls as well. the problem is as soon as the app authorizes with ...