django

Is UTF-8 enough for all common languages?

I just wanted to develop a translation app in a Django projects which enables registered users with certain permissions to translate every single message it appears in latest version. My question is, what character set should I use for database tables in this translation app? Looks like some european language characters cannot be stored...

create a new model instance version instead of update

Hi, I have a model with a version field - autocreate timestamp. When a model instance is being saved I want to create a new instance with a new timestamp instead of updating the old model instance. Is it possible? I thought of overriding the model save() method but I don't know how to create a new instance without creating a infinite ...

IE7 not digesting JSON: "parse error" [resolved]

While trying to GET a JSON, my callback function is NOT firing. $.ajax({ type:"GET", dataType:'json', url: myLocalURL, data: myData, success: function(returned_data){alert('success');} }); The strangest part of this is that my JSON(s) validates on JSONlint this ONLY fails on IE7....

Can I override a query in DJango?

I know you can override delete and save methods in DJango models, but can you override a select query somehow to intercept and change a parameter slightly. I have a hashed value I want to check for, and would like to keep the hashing internal to the model. ...

How to accept localized date format (e.g dd/mm/yy) in a DateField on an admin form ?

Is it possible to customize a django application to have accept localized date format (e.g dd/mm/yy) in a DateField on an admin form ? I have a model class : class MyModel(models.Model): date = models.DateField("Date") And associated admin class class MyModelAdmin(admin.ModelAdmin): pass On django administration ...

Require extended permissions in FBML pyfacebook app

I'm trying to get my FBML canvas page to automatically prompt new app users for permission to publish_stream. Following Facebook's documentation I tried using the required_permissions argument to require_login. That is, I tried to use the pyfacebook require_login decorator like this: @facebook.require_login(required_permissions='publi...

Django "last_login" attribute in auth_user model

It looks like Django does not update last_login field in auth_user model when a visitor is authenticated by saved session. So in this case, how can I implement a similar feature like the "seen" field on very SO user's profile page. ...

Django 1.2 and south problem

Hi, I was using python 2.5 and django 1.0.2. But I moved to python 2.6 and django 1.2 recently and I'm getting the following error now during the migrate: alex@alex-desktop:~/server/mx30$ python manage.py migrate Running migrations for peer_center: - Migrating forwards to 0005_adding_config_model. > peer_center: 0001_initial > peer...

Django database - how to add this column in raw SQL.

Suppose I have my models set up already. class books(models.Model): title = models.CharField... ISBN = models.Integer... What if I want to add this column to my table? user = models.ForeignKey(User, unique=True) How would I write the raw SQL in my database so that this column works? ...

In django 1.1, how do I find a form field's max_length attribute

I have a form that looks like this: class SampleForm(forms.Form): text = forms.CharField(max_length=100) In my django template, I want to reference the fact that the length is 100. I tried {{ form.text.max_length }} to no avail. On a related note, how do I reference this value in python? ...

Django: How to dynamically add tag field to third party apps without touching app's source code

Scenario: large project with many third party apps. Want to add tagging to those apps without having to modify the apps' source. My first thought was to first specify a list of models in settings.py (like ['appname.modelname',], and call django-tagging's register function on each of them. The register function adds a TagField and a cus...

Django admin output extra HTML in ModelSite

Ultimately, I want to add an <iframe> to the display of a particular model on Django's admin page. Django is already rendering the form for this model correctly, but I want to add this <iframe> in addition to Django's form. The src attribute needs to involve the primary key for the currently-displayed record. I've learned how to prope...

Django openid authentication with google

Hello I am looking into authenticating via google. I dont understand how it works:http://code.google.com/apis/accounts/docs/OpenID.html#Samples If i do that 2nd request by entering the data as one url with params into browser i get back XML file. Should i not get back sample response nr3? Can somebody explain this to me? The problem ...

Django : mysql : 1045, "Access denied for user

I have the whole setup working for months on my local computer. I'm installing on a remote site now. Created a fresh mysql DB, and created a new user ("someuser") and gave it complete grants, like so - GRANT ALL PRIVILEGES ON . TO 'someuser'@'localhost' IDENTIFIED BY 'somepassword' WITH GRANT OPTION; I have sync'd the db, using "...

Error in django using Apache & mod_wsgi

Hey, I've been doing some changes to my django develpment env, as some of you suggested. So far I've managed to configure and run it successfully with postgres. Now I'm trying to run the app using apache2 and mod_wsgi, but I ran into this little problem after I followed the guidelines from the django docs. When I access localhost/myapp...

Django: Display image in admin interface

I've defined a model which contains a link an image. Is there a way to display the image in the model items list? My model looks like this: class Article(models.Model): url = models.CharField(max_length = 200, unique = True) title = models.CharField(max_length = 500) img = models.CharField(max_length = 100) # Contains path t...

Comparing two fields in django

Hi can any body suggest me any idea about how can i compare two fields in django. as i have two password fields in my forms.py file. now i want to compare the two fields and if both are same then save the user in database else append an error message to reenter the values again. thanks ...

Dynamically expanding Django forms

I would like to create a form where a user can enter an arbitrary # of items in separate textboxes. The user could add (and potentially remove) fields as needed. Something like this: I found the following different solutions: http://www.eggdrop.ch/blog/2007/02/15/django-dynamicforms/ http://dewful.com/?p=100 These methods both appea...

How to deal with multiple sub-type of one super-type in Django admin

What would be the best solution for adding/editing multiple sub-types. E.g a super-type class Contact with sub-type class Client and sub-type class Supplier. The way shown here works, but when you edit a Contact you get both inlines i.e. sub-type Client AND sub-type Supplier. So even if you only want to add a Client you also get the fi...

Generating two thumbnails from the same image in Django

Hello, this seems like quite an easy problem but I can't figure out what is going on here. Basically, what I'd like to do is create two different thumbnails from one image on a Django model. What ends up happening is that it seems to be looping and recreating the same image (while appending an underscore to it each time) until it throws ...