django

Why JQuery Autocomplete displays only one item?

Am using JQuery Autocomplete on my templete, but as i get the results the Autocomplete only displays one item despite that the results that are fetched have more that one item. It only shows the first item on the list! Example: if i have a result list with ('python', 'pythonism', 'pythodus') and on the autocomplete i type 'pyt' it onl...

Is this a bug with variable access in Google Application Engine + Django?

Recently I've spotted a very disturbing issue. I've got the following python code: for cat in cats: cat.pages = ['apple', 'table', 'computer'] template_values = { 'cats': cats } path = os.path.join(os.path.dirname(__file__), 'templates/index.html') self.response.out.write(template.render(path, template_values)) The index.html d...

How do you remove html tags using Universal Feed Parser?

The documentation lists the tags that are allowed/removed by default: http://www.feedparser.org/docs/html-sanitization.html But it doesn't say anything about how you can specify which additional tags you want removed. Is there a way to do this using Universal Feed Parser or do you have to do further processing using your own regex and...

What's a good way to mix RSS feeds using Python?

SimplePie lets you merge feeds together: http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date Is there anything like this in the Python world? The Universal Feed Parser documentation doesn't say anything about merging multiple feeds together. ...

How to unescape apostrophes and such in Python?

I have a string with symbols like this: ' That's an apostrophe apparently. I tried saxutils.unescape() without any luck and tried urllib.unquote() How can I decode this? Thanks! ...

Overriding the save method in Django ModelForm

I'm having trouble overriding a modelform save method. This is the error I'm receiving: Exception Type: TypeError Exception Value: save() got an unexpected keyword argument 'commit' My intentions are to have a form submit many values for 3 fields, to then create an object for each combination of those fields, and to save each of th...

django AuditTrail vs Reversion

I am working on an new web app I need to store any changes in database to audit table(s). Purpose of such audit tables is that later on in a real physical audit we can asecertain what happened in a situation, who edited what and what was the state of db at the time of e.g. a complex calculation. So mostly audit table will be written and ...

How do you make a Django app pluggable?

Say for example I have a Blog app that I want to be able to drop into different projects, but I always want the Blog to be associated with some other model. For example, in one case I may want it to be associated with a user: site.com/someuser/blog But on another site I want it to be associated with, say, a school: site.com/someschool...

GAE + Django. app-engine-patch or django-gae-helpers?

I'm building app using GAE and wanted to use Django for that. Which "patch" is better? app-engine-patch or django-gae-helpers? I mean functionality and future of them (will one of them die soon). ...

accessing the upload file in progress using django + nginx + apache mod_wsgi

I know that when we upload to a web application which use django, we couldn't access the upload file before it completely receive by the server. So my question, is there any way to check/access the total byte of upload file in progress? thanks ...

How to use generic foreign key in custom m2m relationship model

In first version we can use custom table for ManyToManyField with parameter through=MyModel. MyModel should include foreign keys. But I want to use generic foreign key: content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') content...

SyntaxError in finally (Django)

Hello! I'm using Django, and I have the following error: Exception Type: SyntaxError Exception Value: invalid syntax (views.py, line 115) My viws.py code looks like this: def myview(request): try: [...] except MyExceptionClass, e: [...] finally: render_to_response('template.html', {}, context_instance = RequestContext(req...

What's the best way to display accurate current time and date in Django?

Currently my method involves creating a context processor which is then included sitewide. However, I notice I have problems accounting for daylight saving time changes. I live outside of the U.S. BTW and my server is in the U.S. but its time zone is set to mine. However since we don't account for daylight saving time, it's always one ho...

What are PHP's advantages over Ruby on Rails and Django?

PHP was the undisputed king of easy webapp development, until Ruby on Rails, Django, and other dynamic programming frameworks appeared. What are, in your opinion, PHP's strengths against the newcomers? ...

How can I detect multiple logins into a Django web application from different locations?

I want to only allow one authenticated session at a time for an individual login in my Django application. So if a user is logged into the webpage on a given IP address, and those same user credentials are used to login from a different IP address I want to do something (either logout the first user or deny access to the second user.) ...

django apache on windows setting problem

python setting at httpd.conf: <Directory "C:/depot/projects/web/"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all AddHandler python-program .py PythonHandler mod_python.publisher PythonPath "['C:/Python25/Lib/site-packages/mod_python/',]+sys.path" PythonDebug O...

Change/adapt date widget on admin interface

Hi! I'm configuring the admin site for my new app, and I found a little problem with my setup. I have a 'birth date' field on my database editable via the admin site, but, the date widget isn't very handy for that, because it makes that, if I have to enter i.e. 01-04-1956 in the widget, i would have to page through a lot of years. Also...

Changing case (upper/lower) on adding data through Django admin site

I'm configuring the admin site of my new project, and I have a little doubt on how should I do for, on hitting 'Save' when adding data through the admin site, everything is converted to upper case... Edit: Ok I know the .upper property, and I I did a view, I would know how to do it, but I'm wondering if there is any property available f...

How to implement breadcrumbs in a Django template?

Some solutions provided on doing a Google search for "Django breadcrumbs" include using templates and block.super, basically just extending the base blocks and adding the current page to it. http://www.martin-geber.com/thought/2007/10/25/breadcrumbs-django-templates/ http://www.djangosnippets.org/snippets/1289/ - provides a template tag...

How to handle variables in templates inheritance

I just want to define id attribute of body tag in child template. First solution works perfectly: base.html: [body{% block bodyid %}{% endblock %}] child.html: {% block bodyid %} id="myId"{% endblock %} It's simple and cool! But I don't like to point id="myId" in every child template. I want just send value 'myId' to parent tem...