django

Django forms

I had asked a question pertaining to this. But I think it would be better to ask my question directly. I have a "User" table with manytomany relationship with two other tables "Domain" and "Groups". So in the admin interface I see the Groups and Domains as 2 ModelMultipleChoiceFields. But I want to present them on the UI in a more user f...

What is the quickest way to build admin interfaces in PHP?

What's the quickest way to build admin interfaces in PHP? It can be a framework, a library/libraries coupled with a particular approach, or whatever. Background: I'm a Django developer spoiled by auto admin who has to deliver a web-app in PHP. The app is very admin-area/form heavy and has different access levels. ...

Django Form Preview - How to work with 'cleaned_data'

Thanks to Insin for answering a previous question related to this one. His answer worked and works well, however, I'm perplexed at the provision of 'cleaned_data', or more precisely, how to use it? class RegistrationFormPreview(FormPreview): preview_template = 'workshops/workshop_register_preview.html' form_template = ...

How to query as GROUP BY in django??

I query a model, Members.objects.all() and it returns say Eric, Salesman, X-Shop Freddie, Manager, X2-Shop Teddy, Salesman, X2-Shop Sean, Manager, X2-Shop What i want is, to know the best DJango way to fire a group_by query to my db, as like, Members.objects.all().group_by('designation') Which doesn't work of course...

Deploying Google Analytics With Django

We're about to deploy a new Django website, and we want to use Google Analytics to keep track of traffic on the site. However, we don't want all of the hits on development instances to contribute to the Google Analytics statistics. There are a few ways we could deal with this: have a configuration option in settings.py which the base...

How to safely update a live website

We have a fairly simple Django-based website for doing CRUD operations. I've been doing testing and development locally and then checking out releases and database schema changes onto the live server once testing is done. We've recently run into a problem when releasing some types of changes. Imagine the following sequence of events: U...

Hello world Pyamf small error message

Hi i am trying to link flex to django with Pyamf As a first step i tried the basic Hello World http://pyamf.org/wiki/DjangoHowto But that results in an ErrorFault. I use django 1.0.2 amfgateway.py in the root folder of my project (same level as settings) import pyamf from pyamf.remoting.gateway.django import DjangoGateway from djan...

django update modelform

I have a model as follows class UserPrivacy(models.Model): user = models.ForeignKey(User) profile = models.SmallIntegerField(default=1, choices=PRIVACY_TYPE) contact = models.SmallIntegerField(default=1, choices=PRIVACY_TYPE) friends = models.SmallIntegerField(default=1, choices=PRIVACY_TYPE) location = models.SmallI...

Looking to get started with Apache, PHP, MySQL, Python, Django on a fresh Mac...

I've looked for other questions, but could not find any... I have freshly installed my Mac with OSX 10.5. I need to learn Python/Django for a new job, so want to set it all up correctly, ready to develop and run from my browser using http://localhost/ I come from a PHP background and always used MAMP before. But I want to get everythin...

Django: Calling custom Model method from Form clean method. "Unbound Method"?

I'm having a problem while trying to call a custom Model method from my Form clean method. Here is [part of] my model: http://dpaste.com/hold/12695/ Here is my Form: http://dpaste.com/hold/12699/ I'm specifically having a problem with line 11 in my Form: nzb_data = File.get_nzb_data(nzb_absolute) This raises the following error: Typ...

Django Admin

I am using Django admin for managing my data. I have a Users, Groups and Domains tables Users table has many to many relationship with Groups and Domains tables. Domains table has one to many relationship with Groups table. and when I save the User data through admin I also need some addtional database updates in the users_group and the...

Django re-group doesnt work as expected.

I jumped into learning django recently. I am rendering my template with citylist like, {'citylist': Cities.objects.all()} And want to reqroup on country in template (same as in django-docs) below: {% regroup citylist by country as coutrylist %} <ul> {% for country in countrylist %} <li>{{ country.grouper }} <ul> {% ...

Django: Open uploaded file while still in memory; In the Form Clean method?

I need to validate the contents of an uploaded XML file in my Form clean method, but I'm unable to open the file for validation. It seams, in the clean method, the file hasn't yet been moved from memory (or the temporary directory) to the destination directory. For example the following code doesn't work because the file hasn't been mov...

Inserting A Heading Into A Django Form

I would like my form to output something like this: Name: ___________ Company: ___________ Interested in ------------- Foo: [ ] Bar: [ ] Baz: [ ] That is to say, I would like to have the 'Interested In' title inserted in the middle of my form output. One way of doing this would be to write out the template code for each field, and i...

How to make project templates and Satchmo templates co-exist?

I'm working with a Satchmo installation that resides within an existing project. This project has its own templates as well as templates for some of the various apps that are installed. Some of these app-specific templates have their own app_base.html variations that expect to derive form base.html. I'd like to be able to do the same ...

Django form - set label

I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done? I'm trying to do it in my __init__, but it throws an error saying that "'RegistrationFormTOS' object has no attribute 'email'". Does anyone know how I can ...

Django: Uploaded file locked. Can't rename.

I'm trying to rename a file after it's uploaded in the model's save method. I'm renaming the file to a combination the files primary key and a slug of the file title. I have it working when a file is first uploaded, when a new file is uploaded, and when there are no changes to the file or file title. However, when the title of the file...

Django with Passenger

I'm trying to get a trivial Django project working with Passenger on Dreamhost, following the instructions here I've set up the directories exactly as in that tutorial, and ensured that django is on my PYTHONPATH (I can run python and type 'import django' without any errors). However, when I try to access the url in a browser, I get ...

Paging depending on grouping of items in Django

For a website implemented in Django/Python we have the following requirement: On a view page there are 15 messages per web paging shown. When there are more two or more messages from the same source, that follow each other on the view, they should be grouped together. Maybe not clear, but with the following exemple it might be: An ex...

Setting object owner with generic create_object view in django

Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key? P.E: class Post(models.Model): text = models.TextField() author = models.ForeignKey(User) What I want is to use create_object and fill author with request.user. ...