django

Non-public image upload

By default, Django uploads images to the MEDIA_ROOT setting, which is assumed to be a publicly accessible directory. I don't want users to be able to upload images and to have those images immediately accessible. Instead, I want the images to be uploaded to a non-public tmp directory. Later on, a site moderator will approve images in ...

Problem with Twitter app using python and django

Hi , I was creating a twitter application with Django. I used the twitter lib from http://github.com/henriklied/django-twitter-oauth for OAuth , as specified in the twitter example pages . But I am not too sure how to redirect user to my application home page once the authentication with twitter is over . The code for oauth_reque...

Apache Can't Access Django Applications

so here's the setting: The whole site is working fine if I remove the application (whose name is myapp) in the INSTALLED_APPS section in the settings file I added WSGIPythonHome in apache2.conf I can successfully access the apps via the the interactive python shell in Django (python manage.py shell). I can create, update and delete...

python pyrad problem

Hi all, I setup some RADIUS backend to allow AD authentication via the 'admin' of django. Alltough i got a problem with some dictionaries, i really don't know what i'm doing wrong. This is the error i got: IOError at /admin/ Errno 2] No such file or directory: '/home/pl/dictionary.compat' I installed pyrad, so it should be there and i...

Django - ManyToManyField in a model, setting it to null?

I have a django model (A) which has a ManyToManyField (types) to another model (B). Conceptually the field in A is an 'optionally limit this object to these values'. I have set blank=null and null=True on the ManyToManyField. I have created an object from this model, and set types to some values. All is good. I want to set it to 'null',...

Django ajax file upload problem csrf

I'm trying to do a ajax file upload using django. I am trying to make this example work http://www.johnberns.com/2010/07/08/using-valums-jquery-ajax-upload-with-django-1-2/ But strangely I keep getting "None" for my csrf token and even more strange is that I am doing the POST call sending the file but all I get on the server is just th...

Django question

Hello, I have a django app that suppose to display invoices and clients. Now for some reasons When I run the Django sever, for some reasons it only displays the invoice data in invoice_list but cannot displays the clients data in clients_list. The clients data does shows up in another view, but not in invoice_details view. EDIT: I Seem...

Jython, Django with Sqlite3

NOw i create project by using jython 2.5.2b2 and django1.1.1 (lucid) , after download sqlitejdbc-v056.jar and do some syncdb task its shown "zxJDBC.Error: auth_permission.content_type_id may not be NULL [SQLCode: 0]" but still can runserver, anyone has some great example for this situation?.:) ...

Dynamically creating classes - Python

Hi folks, I need to dynamically create a class. To go in futher detail I need to dynamically create a subclass of Django's Form class. By dynamically I intend to create a class based on configuration provided by a user. e.g. I want a class named CommentForm which should subclass the Form class The class should have a list o...

Django i18n not working on python files

Hi guys, Django newbie here, I'm using Django's i18n to translate my website. My templates get translated just fine using the trans template tag However, when I try to translate strings in my python files, for instance this form field's label: from django.utils.translation import gettext as _ class RegForm(forms.Form): form_fiel...

How do I pass a JSON object to FullCalendar from Django (by serializing a model)?

FullCalendar supports taking in a JSON object through AJAX for it's events, this can be done on initialization or later like this: $('#calendar').fullCalendar('addEventSource', "/{{ user }}/events/" ); The serialization itself in my Django view looks like this: ... events = Event.objects.filter(user=request.user, start__gte=start, en...

How to avoid duplicate models in django project ?

Hi, i'm learning django so i've many questions, and one is how i can reuse a model? i mean the models live in the application folder, but some models are exactly the same between two differents applications. So should i rewrite the model every time that i write a new app? ...

Language problem with date based generic views

I've changed the language-code from en-us to es-ar and the url's began to fail. Example: When I click in "Agosto 2010" the URL is "http://mysite.com/weblog/2010/ago/" and the server couldn't finde the page. But if I browse "http://mysite.com/weblog/2010/aug/ the server finds and shows the page. urls.py: urlpatterns = patterns('django....

How do I properly format a StringIO object(python and django) to be inserted into an database?

I have a requeriment to store images in the database using django, and for that I created a custom field : from django.db import models class BlobField(models.Field): __metaclass__ = models.SubfieldBase def db_type(self, connection): #TODO handle other db engines backend = connection.settings_dict['ENGINE'] ...

Django / MySql not honouring unique_together

I am using django with mysql (InnoDB) and have the following in my django model: class RowLock(models.Model): table_name = models.CharField(blank = False, max_length = 30) locked_row_id = models.IntegerField(null = False) process_id = models.IntegerField(null = True) thread_id = models.IntegerField(null = True) class...

What is location of django Built-in tags and filters?

What is location of django Built-in tags and filters? I cant find anywhere... I need it to format datetime so then i can send right formt in JSON by AJAX response.. Or maybe you can suggest me another way to do that... What i want to do it's import function which determinate filter... and use it to format my datetime in JSON. Look.. i ...

[Django] Get parameters of object in metaclass of this object

My problem is a python/django mix. I have a form model that will display some fields. Basing on some parameter of this model, the data sent to metaclass creating this object should differ. But how can I reach this parameter when inside the body of Meta ? Should I use some global var instead of object parameter (as it is introduced only t...

Django admin site: how to compute field from multiple fields value?

I am wondering if is there a way to compute a field in the admin site based on a concatenation of multiple fields. Basically I have a Product model with different fields associated to various attributes (colour, size, length etc). I would like to compute the code value to be a concatenation of the values of the various attribute field...

Post Binary Sting to Django app using HTML 5

Hi all - I read in a file via HTML5 FileReader and jQuery like so: holder.ondrop = function(e) { this.className = ''; e.preventDefault(); var file = e.dataTransfer.files[0], reader = new FileReader(); reader.onloadend = function(event) { $.ajax({ url:"/path/to/upload", type: "POST", ...

How can i Make add items list using modelformset ?

How can i go about making list that do this in Django. I want it to look like: Item A add Item B add Item C add where items are from Item models. When the add button is clicked, the item will be added to a list model. I use modelformset so that i could get Item list which is already populated in the Item model. I have...