django

[Solved] django facebook connect missing libs?

hello, I'm trying to integrate some photo related functionality with my site and facebook. I checked out facebook connect and it seems like the way to go for this (since I don't want to make an app, just have users authenticate and then grab some content from facebook to integrate into our site) First of all, if you think there is a bet...

What is the best practice to use ExtJS with Django Framework

I like to use django in the server side with extjs in the client. Possibly using a REST interface for publishing the resources. Ideas about that? thanks. ...

radio button request syntax in view

Hello, I'm trying to write an html form, that includes a radio button and keyword search. The code is here: http://dpaste.com/115844/ The django view is not recognizing this syntax: pubtypeid = request.GET['pubtypeid'] Can someone please help me write this correctly? Thanks, Ana ...

How to chain views in Django?

I'm implementing James Bennett's excellent django-contact-form but have hit a snag. My contact page not only contains the form, but also additional flat page information. Without rewriting the existing view the contact form uses, I'd like to be able to wrap, or chain, the views. This way I could inject some additional information vi...

Django - how do you turn an InMemoryUploadedFile into an ImageField ?

I've been trying help(django.db.models.ImageField) and dir(django.db.models.ImageField), looking for how you might create a ImageField object from an image that is uploaded. request.FILES has the images as InMemoryUploadedFile, but I'm trying to save a model that contains an ImageField, so how do I turn the InMemoryUploadedFile into the...

Problem using django mptt

Hi, I am having problem implementing django mptt. Here is my model: class Company(models.Model): name = models.CharField( max_length=100) parent = models.ForeignKey('self', null=True, blank=True, related_name='children') mptt.register(Company, order_insertion_by=['name']) And class Financials(models.Model): ...

How can I use django forms/models to represent choices between fields?

How can I use boolean choices in a model field to enable/disable other fields. If a boolean value is true/false I want it to enable/disable other model fields. Is there a way to natively express these relationships using django models/forms/widgets? I keep writing custom templates to model these relationships, but can't figure out a g...

can i use a database view as a model in Django?

i'd like to use a view i've created in my database as the source for my django-view. Is this possible, without using custom sql? ****13/02/09 UPDATE********* Like many of the answers suggest, you can just make your own view in the database and then use it within the API by defining it in models.py. some warning though: manage.py sy...

Why does Django only serve files containing a space?

I'm writing a basic Django application. For testing / development purposes I'm trying to serve the static content of the website using Django's development server as per http://docs.djangoproject.com/en/dev/howto/static-files/#howto-static-files. My urls.py contains: (r'^admin/(.*)', admin.site.root), (r'^(?P<page_name>\S*)$',...

AJAX command-line interface in browser

I'm building a Web app to allow users to view and manipulate data, particularly numeric and geographic data. It's important that the output be clear and professional (data grids, Google Map overlays, etc.). But in terms of the user interface, I'd rather start with the flexibility of a command-line interface before building GUI-style form...

How do I use django mptt?

I have a model: class Company(models.Model): name = models.CharField( max_length=100) parent = models.ForeignKey('self', null=True, blank=True, related_name='children') mptt.register(Company, order_insertion_by=['name']) and class Financials(models.Model): year = models.IntegerField() revenue = models.DecimalField(ma...

How to repeat a "block" in a django template

I want to use the same {% block %} twice in the same django template. I want this block to appear more than once in my base template: # base.html <html> <head> <title>{% block title %}My Cool Website{% endblock %}</title> </head> <body> <h1>{% block title %}My Cool Website{% endblock %}</h1> </body> </htm...

Django Installed Apps Location

Hi, I am an experienced PHP programmer using Django for the first time, and I think it is incredible! I have a project that has a lot of apps, so I wanted to group them in an apps folder. So the structure of the project is: /project/ /project/apps/ /project/apps/app1/ /project/apps/app2 Then in Django settings I have put this: INS...

What is the best AJAX library for Django?

Which and why is the best AJAX library for django? Which one has the biggest database of tutorials, books and most detailed documentation? Which one is the easiest to work with? Which one is in early developing stage but may become the one? Regards, chriss ...

How do I implement a common interface for Django related object sets?

Here's the deal: I got two db models, let's say ShoppingCart and Order. Following the DRY principle I'd like to extract some common props/methods into a shared interface ItemContainer. Everything went fine till I came across the _flush() method which mainly performs a delete on a related object set. class Order(models.Model, interface...

Django: retrieving abstract-derived models

After getting fine answer to my previous question, I came across another problem. I followed the third approach, being aware of what djangodocs say about abstract model subclassing. I am using the latest Django, rev 9814. The strange behaviour I get: In [1]: o = Order() In [2]: o.save() DEBUG:root:STORING EVENT MESSAGE: Order created...

Overriding a JavaScript results in infinite loop in IE but not in Firefox

I'm using the following code to override a JavaScript function named dismissRelatedLookupPopup(). In Firefox, this works without a problem (displays the alert once and runs my code), but in Internet Explorer 7 it results in an infinite loop displaying the alert() forever. I'm doing this because I don't control the code where dismissRelat...

BinaryFields in Django Models

I have a twenty byte hex hash that I would like to store in a django model. If I use a text field, it's interpreted as unicode and it comes back garbled. Currently I'm encoding it and decoding it, which really clutters up the code, because I have to be able to filter by it. def get_changeset(self): return bin(self._changeset) de...

Execute a string as a command in python

I am developing my stuff in python. In this process I encountered a situation where I have a string called "import django". And I want to validate this string. Which means, I want to check whether the module mentioned('django' in this case) is in the python-path. How can I do it? ...

With Django, what's the correct way to set up paths to the admin content and static content?

I have a Django site set up that uses the Django admin panel, prefixed with /media/, as well as static site content in a directory called /static/. The admin media stuff, of course, lives within the Django package, and the site's static content is stored along with the Python code for the site. Currently, my public_html just contains ap...