django

Modifying QuerySet result

Is it possible to change some specific items in a QuerySet object? In my case i'm trying to slicing "title" fields with length more than 40 characters and append "..." at the end of field. ...

How to create one Model (table) for each user on django ?

I have a Model, and want every User of the system has a table reserved for himself, respecting this Model. To make it clear: Imagine the Model "Games". I do not want that there is only one table "games", but there is: foo_games, bar_games (foo / bar are users of the system) How to do this ? edit: why ? Imagine I have 1000 users, ...

Setting a Compact Privacy Policy with Django

Hi, How do I set a P3P compact privacy policy from Django so that IE accepts cookies from my site when the security settings are on HIGH - i.e. no cookies accepted unless there's a Compact Privacy Policy. Cheers Guy ...

Django CSRF Framework having many failures

I'm getting many failures from the CSRF Django middleware on my site (the version from SVN trunk.) The only errors I get are: CSRF failure: reason=CSRF token missing or incorrect. How could I diagnose where these CSRF errors are coming from? I can't cause the CSRF errors myself, but I setup the site to email me whenever the CSRF error...

ChoiceField doesn't display an empty label when using a tuple - am I doing something wrong?

What I'm trying to do I'm going to be keeping data about competitions in my database. I want to be able to search the competitions by certain criteria - competition type in particular. About competition types Competition types are kept in a tuple. A slightly shortened example: COMPETITION_TYPE_CHOICES = ( (1, 'Olympic Games'), ...

Django-Piston: ManyToManyField handling?

Bit of a lazyweb question here: anybody know how django-piston handles writes (create/update) to ManyToMany fields? ...

Django Admin - add collapse to a fieldset, but have it start expanded

Is there a way to make a fieldset collapsible, but start expanded? When you add collapse to the fieldset classes, it gets the functionality but starts collapsed. I've taken a look at the JS that shows/hides the fieldset content, but it doesn't look like there's anything in there to do what I'd like it to, so I'm assuming I'll have to r...

How to get django and jquery .ajax to play nice - not triggering success

At this all evening and can't see what I'm missing: JS: $(document).ready(function() { $("#form").submit(function () { var txt = $('textarea[name=text]').val(); $.ajax({ type: "POST", url: "/parse_text/", data: {"text": txt}, dataType: "text", success: fun...

how to insert a infomation on a table in Django

This is my form on models.py class ItemForm(forms.Form): itemname = forms.CharField(max_length=100) itemwording = forms.CharField(max_length=100) notes = forms.CharField() abundance = forms.IntegerField(max_value=10) collunit = forms.CharField(max_length=50) litref = forms.CharField(max_length=100) litkey = ...

Redirect realtime common line output to Django HttpResponse

In a long run command line execution, like uncompressing a large .zip archive, how to redirect the realtime output of unzip command to browser via Django's HttpResponse? EDIT: According to paul's suggestion, I did a search and found this question has answers to how to return a HttpResponse by using a generator. http://stackoverflow.co...

Querying multiple index in django-sphinx

The django-sphinx documentation shows that django-sphinx layer also supports some basic querying over multiple indexes. http://github.com/dcramer/django-sphinx/blob/master/README.rst from djangosphinx.models import SphinxSearch SphinxSearch('index1 index2 index3').query('hello') It seems SphinxSearch does not contain the function qu...

django.utils.encoding.DjangoUnicodeDecodeError

I got the following error when tried to add an entry to a Django model via generic relations. django.utils.encoding.DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xb8 in position 24: unexpected code byte. You passed in 'ASL/60Styles_Timeless-3_\xb8 CaLe.asl' (<type 'str'>) The model is like this: class MD5(models.Model): ...

Different response by screen solutions using Django and jQuery

In a thumbnail website, if I want to display 100x100 thumbs on screnn resolutions lower than 1280x1024 while display 150x150 thumbs for screens higher than 1280x1024, is the following procedure correct? Render a page frame with no thumbs by view1() On page frame loaded, it detects client's screen resolution and pass it to another Djang...

How would you share a theme between a Django app and a Wordpress blog?

Trying to keep a consistent look & feel between a django site and a wordpress blog is turning into somewhat of a pain and I'm wondering if there's a way to set it up so that stuff only needs to be changed in one place. Most of the appearance stuff that changes is in the header and footer which for Wordpress is in header.php and footer.p...

About grouping sql queries in django…

Hello! I found an ambiguous place in one django-based application that I use in my project, please look at that: if not request.method == 'POST' or not request.POST.get('openid'): raise RedirectException(next, _('Invalid POST data')) if not UserAssociation.objects.filter(user=request.user).count() > 1 and not request.user.email: ...

How to resize just uploaded image?

In VIEW I want to resize uploaded image and save 2 copies of it in model real and changed ...

Django questions: setting the port number and the using an existing database

I have a mini project that I'd like to start on port 2000. How do I do this? Also, how would I set up the project with an existing database? What Django books did you find helpful? ...

General Purpose Progressbar in Django

I want to make a little web-frontend for copying (rsync) and encoding (ffmpeg) files for my Server using Django. And I want to keep track of the progress of the processes. I saw a few jquery-scripts, but they are designed to be used with uploads, and I don't know enough javascript to modify these scripts for my needs. I want to write a ...

Calling small app in template : Django

Lets say I have a website with a small application that lists the 10 newest members, or something dynamic like that. I want this to view on every page, perhaps in a sidebar. How would i go about doing this. My thoughts on the mather... I might not get the whole django thing just yet, but when I have a url like /foo/ calling a view bar -...

return a FaultObject on purpose from pyamf

I am currently migrating from RubyAMF to PyAMF. In RubyAMF you can return a FaultObject deliberately like so: render :amf => FaultObject.new("Thats not your pie!") Is there comparable functionality in PyAMF? I've searched the docs and can't find any mention of it. ...