django

django-registration adding additional fields in the registration form.

Hi everyone, I am interested in adding additional fields in the registration form, like nickname and date of birth. I am using django-registration 0.8, and I am planning to write my own custom form. I have looked at django-profiles and I think that the privacy control with that is not strong enough. I plan to store these additional i...

Occasional ctypes error importing numpy from mod_wsgi django app

Here's the setup: Django (1.2) app on mod_wsgi that imports ctypes Python 2.6.5 Apache 2.2.3 SELinux disabled RedHat EL 5 64bit some of the file system is mounted over nfs Occasionally, when I restart apache I get an import error when it's trying to import ctypes. Every incoming request fails with a 500 error. If I restart apache usu...

django-authopenid provider icons / buttons missing

I followed the setup instructions for django authopenid application. As far as I can tell it is working properly. However, I cannot see the provider buttons/icons for yahoo, google, etc on the sign in with openID portion. Anyone had this problem? Thanks. ...

A tough relationship with Django

Take a look at this model (it's hypothetical): class Manufacturer(models.Model): #... class Car(models.Model): manufacturer = models.ForeignKey(Manufacturer) #... class City(models.Model): #... class Manager(models.Model): manufacturer = models.ForeignKey(Manufacturer) city = models.ForeignKey(City) #... ...

How to get form field's id in Django?

Is there any way to get the id of a field in a template? In the HTML i get: <input name="field_name" id="id_field_name"... I know I can get the name with {{ field.html_name }}, but is there anything similar for getting the id? Or can I only get it like this: id_{{ field.html_name }}? ...

problem with Django model

Hi :) , I use Djnago a few weeks ago I started a django app and wrote these lines in model.py from django.db import models class Publisher(models.Model): name = models.CharField(max_length=30) address = models.CharField(max_lenght=50) city = models.CharField(max_length=60) state_province = models.CharField(max_lengt...

How do I include Django 1.2's CSRF token in a Javascript-generated HTML form?

I recently upgraded to Django 1.2.3 and my upload forms are now broken. Whenever I attempt to upload, I receive a "CSRF verification failed. Request aborted." error message. After reading Django's documentation on this subject, it states that I need to add the {% csrf_token %} template tag within the HTML <form> in my template. Unfortun...

howto Django importing apps from projectA into projectB?

I'm trying to setup a project that contains commons apps (projectA) to be shared by several other Django projects (projectB for the sake of this question). I have a directory structure like: /django/projectA /django/projectB I have updated the PYTHONPATH to include "/django" and I can import files from both projectA and projectB in the...

Restrict certain user accounts to certain IPs in Django

Is it possible to only let a user log in while using a specific IP address? This IP address would be different for all users so simply writing an htaccess rule in Apache would not solve my problem. I also looked into writing a custom authentication backend but I don't see any way I could check the user's current IP address since there is...

django request.post

Hi, I created a custom "like" button. The "like" is inside a post form html element. For my view.py after i process the form post, i only want to return http response success and not load any type of success page. What kind of object would i return in this case? Thanks, David ...

Django ModelForm

Hi all, I am trying to create a simple CRUD with ModelForm. It works fine except that every time I edit, saving creates a new instance of the data. So i edit and get an extra row in DB instead of an updated one. I am at a loss as to how it knows to save an existing charity as it does not store the PK (id) as a hidden field in the form. ...

Django + Google SSO openid

Hi, I would like to have my application http://app.acquee.com/designer to accept a google account as a login. I found a bunch of libs for django but most work on top of existing Django authentication system that I do not use. I have my own set of user tables where I keep user info and privileges. Any suggestion on how to integrate that ...

Python Indentation error

Hi all, I have created a project called class , and an application called students when I write views, I have to use items = class.objects.all() which is giving me error :( please tell me way to overcome the error without changing my project name.. Thanks :) ...

add request.GET variable using django.shortcuts.redirect

Is possible to add GET variables in a redirect ? (Without having to modifiy my urls.py) If I do redirect('url-name', x) I get HttpResponseRedirect('/my_long_url/%s/', x) I don't have complains using HttpResponseRedirect('/my_long_url/%s/?q=something', x) instead, but just wondering... ...

With all the easy Django utilities, tools, configs, settings, etc. is there REALLY no easy way to define the name of a custom App in Admin?

How can I make LadyGagaApp into "Lady Gaga App" when displayed in Admin. Option #1 is to explain how to make this happen in the definition of the app, or in settings, or in init, etc. Option #2 is to point me to the admin template page where this can be overridden with an example. Many thanks all. /Joe ...

How to aggregate records in django based on multiple criteria

Lets say, I have following models in my Django app. class EventGroup name = models.CharField() class Event(models.Model): name = models.CharField() group = models.ForeignKey(EventGroup) class Severity(models.Model): name = models.CharField() group = models.ForeignKey(EventGroup) class LogEntry(models.Model): t...

Django iterate all flatpages in a template

Hi, how can I get a list of all flatpage objects in a template ? I am not using development version .. Thanks ...

How to open a generated PDF file in browser?

I have written a Pdf merger which merges an original file with a watermark. What I want to do now is to open 'document-output.pdf' file in the browser by a Django view. I already checked Django's related articles, but since my approach is relatively different, I don't directly create the PDF object, using the response object as its "fil...

Serializing dictionary in Django to use with Dajaxice or ajax

I'm trying to write a monitor site so the temperature for certain devices gets updated every x seconds. So far I have a function that returns a dictionary using dajaxice. This is my ajax.py: def temperature(request): temperature_dict = {} for filter_device in TemperatureDevices.objects.all(): get_objects = TemperatureData.object...

Using celery in a django app to run script with root priviliges?

I need to run some commands on my ubuntu box where my django project resides that requires root privileges, from within my django project. I'm using celery to fire off an asynch process, this process in turn calls shell commands that requires root privileges to succeed. How can I do this without risking creating huge security holes? P...