django

Django unique_together and flagging objects as "deleted"

I'm implementing the first option discussed in "Marking for deletion in Django", that is, when an object is no longer active, I set a boolean to mark it as inactive. The specific reason I'm using this method is that although the object is no longer in active use, it may still be referenced and displayed in various records and reporting ...

How to put braces in django templates?

I need to produce an id surrounded by braces ( for example "{1234}" ). With the django template language, braces are also used to start a variable substitution, so I have some trouble in obtaining what I want. I tried {{{ id }}} {{ '{'id'}' }} {{ '{'+id+'}' }} { {{ id }} } None of these methods work, except the last one, which unfortu...

jqgrid dropdown select editoptions

Hi, I am trying to use the edittype:"select", formatter:"select" and editoptions:{values:'1:Type1;2:Type2'} in my colModel colModel : [ {name:'pk', index:'pk', width:20, sortable:true, jsonmap:'pk', sorttype:'integer'}, {name:'id', index:'id', align:'left', jsonmap:'fields.id', sortable:true...

csv download in a django template

In a django app, i need to show the result of a search, and let the user downloading a csv file of the result. Actually i just wrote a view that take the form args to make the query via the ORM and present the result in a Table in the template. here the end of the view: return render_to_response(template, {'form': form, 'object_list': ...

How to generate a choicelist from all ImageSpecs

I want to generate a choicelist for all specs that inherit from imagekit.specs.ImageSpec. The idea is to allow users of the admin interface to select an ImageSpec to add to a picture. i.e: class Display(ImageSpec): pre_cache = True increment_count = True processors = [ResizeDisplay,] class SingleDisplay(ImageSpec): pr...

Django extensions error message

Hello, Im a django beginner and am using it on a windows machine. Now when i run 'python manage.py runserver', im getting the following message : "Error: No module named django_extensions" Any way to fix this ? Thank You ...

What may be the problem (Django views)...?

I am writing a GUI application using Django 1.1.1. This is the views.py: from django.http import HttpResponse def mainpage(request): f=open('pages/index.html','r').readlines() out='''''' for line in file: out+=line print out return HttpResponse(out) I am trying to load the contents of index.html which is...

Django: Printing a queryset dynamically in the template

How can I print the columns specified in "fields_i_want" instead of hardcoding the column names in the template code? # Let's say I have this in my view: foo = Foo.objects.filter(some_field='bar').select('field1', 'field2', 'field3') fields_i_want = ['field1', 'field2'] # Then in the template I want to do something like this: <TABLE id...

django localisation with one language

Hello, I would like to use localisation in my application in the future. So I would like to have my code prepared. But I have the problem, if user come from language other than CS(main one). In this time, i would like to have all people across the world see just only CS version. I already set my LANGUAGE_CODE = 'cs'. But when i come wi...

How can i get a list of objects from a postgresql view table to display.

this is a model of the view table. class QryDescChar(models.Model): iid_id = models.IntegerField() cid_id = models.IntegerField() cs = models.CharField(max_length=10) cid = models.IntegerField() charname = models.CharField(max_length=50) class Meta: db_table = u'qry_desc_char' this is the SQL i use to create the table CRE...

secure and efficient file uploader

I am looking for a decent file uploader. I'm using django, but while i don't NEED a django file uploader, python is preferable. php would also be fine. can anyone point me in the direction of a good file uploader which is secure and efficient? EDIT: I need the server-side handler of file uploads. ...

Django date filter by day of month

I need to write a query that returns all object less that or equal to a certain day of a certain month. The year is not important. It's easy enough to get an object by a particular day/month (assume now = datetime.datetime.now()): posts = TodaysObject.objects.filter(publish_date__day=now.day, publish_date__month=now.month) But I can't...

Django: how to store subdomain-based authentication usernames?

I need to create a subdomain based authentication system, like the one 37signals, freshbooks, codebase use. That is, each subdomain of my main application needs to have its own username namespace. I would like to keep as much as possible of the django authentication system. What is a good way to store the username? In particular, it sh...

How to create queues of objects in Django?

I am new to Django and I am trying to build a blog myself. I'm trying to create a feature I've seen implemented in Drupal using the nodequeue module. What I want to do is to be able to create queues of objects, for example, queues of blog posts. Below, I describe how I imagine the queues to work: the size of each queue should be user-...

Retrieving all querystring variables from request object

In my django view, i have logic that retrieves a querystring variable called url from the request object like so: link: http://mywebsite.com/add?url=http://www.youtube.com/watch?v=YSUn6-brngg&amp;description=autotune-the-news url = request.Get.get("url") The problem arises, for example,when the url variable itself contains parameters...

Django: How to block the entry includes only spaces or breaklines

I don't want someone visit my site to comment that only spaces, breaklines on the form. How do I use the command "if" in this case? Thanks for answers ! ...

Can anyone tell me why Apache will not work, for my Django?

I get this problem when I visit my domain.com. I have compared this with my other website with the SAME set-up (just different username!!!) For some reason that website works and this one doesn't. Forbidden You don't have permission to access / on this server. Apache/2.2.3 (Red Hat) Server at www.mydomain.com Port 80 In terms of perm...

How to create a resizeable TinyMCE textarea?

I have a Django form using textareas and TinyMCE for text entry. I would like to add a slider to change the vertical size of the textarea, like SO has them so nicely. How can this be done? ...

how should i store and retrieve images with django on appengine?

I'm using appengine patch with django 1.1 (came with appengine patch). I have a page with multiple columns and multiple files. In the admin I want to be able to upload an image and write text in a column like so: This is the sory of bugs bunny ... <img src="/pages/file/agphZXAtc2FtcGxlchALEgpwYWdlc19maWxlGAUM/" alt="didnt work" /> some ...

Filtering by custom date range in Django admin

Can Django admin site select entries by a custom date range, i.e. using two DateFields with AdminDateWidget? I know that there are date_hierarchy and list_filter properties, but they don't seem very useful when there are a lot of DB entries and you just need to filter items by exact date__gte and date__lte query. ...