django

OSError on uploading files in Django

While trying to send form with image field in it I'm getting : Exception Type: OSError at /user/register/ Exception Value: (13, 'Permission denied') Of course first thing I've checked were the permissions to my folders, and just in case set them to 777 on the whole path from '/'. Still nothing. So I've tried adding parameters to setting...

django model -- relationships between inherited models?

I'm working on a server / datacenter inventory management tool. I have a class to define a default "device", which is then used to express custom devices (linux servers, windows servers, routers, switches, etc.) I also have data models set up to express IP addresses within a network. My question is, what would be the best way to expre...

How to access model data when overriding Django admin templates?

Hello - sorry if this is an obvious question but I have been searching for a few days and have not been able to come up with a result. I am creating a simple photo gallery app. There are four galleries, each containing a photo (the photo consists of a 'before' image, 'after' image and caption). I am trying to use django-admin to allow...

Unescaping HTML in Django

I have html encoded text which reads like this: RT <a href="http://twitter.com/freuter"&gt;@freuter&lt;/a&gt;... I want this displayed as html but I am not sure if there is a filter which i can apply to this text to convert the html-encoded text back to html ... can someone help? ...

Imports failing for pylint

I'm testing my project using pylint and currently getting fatal error when importing the internal apps into the project using. According to pylint, the import should be something like from <appname>.models import ... as opposed to what I currently have: from <projectname>.<appname>.models import My problem is that when I use the recomm...

django-mptt & django 1.2

From the homepage of django-mptt Version 0.2.1 is not compatible with Django 1.0 and above - please use SVN trunk for now I tend to avoid using trunk for work that is going live any time soon, But I have a rush job. Does it work with Django 1.2, (beyond "hello world" equivalents) Does anyone have any current experience / odd bugs ...

Django - limiting url access to superusers

In my urlconf, i have: url(r'^sssssh/(.*)', staff_only_app.site.root), What I'd like to do is limiting any access to this application to superusers. I tried this: url(r'^sssssh/(.*)', user_passes_test(staff_only_app.site.root, lambda u: u.is_superuser)), But it complains that decorate takes exactly 1 argument, and I gave two. I'...

Installing django with python 2.5 and not with the default version of python.

Hi all, I have to install Django on my linux server where python 2.4 is available as the default installation. I have installed python 2.5 as a separate version. Now I have to install Django which I have to use with python 2.5. Is there any specific requirement, so that it is installed with the python 2.5 and not with the default 2.4 ve...

Feedback wanted for my first django custom field!

Hi I've created my first custom django field. Its a social security number field (Cpr) following danish syntax. As I'm new to both python and django i would love to get some feedback on the code! import django.forms as f from datetime import datetime import json from django.utils.safestring import mark_safe from django.core.exceptions i...

Django return HttpResponseRedirect to an url with a parameter

Hello, I have a situation in my project where i need to make a redirection of the user to an url containing a parameter, (it is declared in the urls.py like: url(r'^notamember/(?P<classname>\w+)/$', notamember, name='notamember'),) How can i put that parameter in the return HttpR...

What is django? Can i use it with jsf??

Hello at present I am using jsf+hibernate+spring and i need to get data from session using django and iam new to it so any one can help me.... ...

Is it possible to prevent a base template reloading using django's template inheritance?

In the header region of my base template (main.html), I've placed an HTML5 media player which pulls in content uploaded through my admin interface. What I'm attempting to do is, when the tracks have been loaded once, have the media player remain unaffected by internal site navigation. In other words, the media player keeps playing but ...

Can Polymodel classes be used with Basemodel in the Google App Engine Django Helper?

The Django Helper for Google App Engine creates BaseModel to allow a model to exist both in Django and App Engine. Does the helper provide a way to use Polymodels with Django? ...

Jquery Ajax call with django

Dear, I'm a bit stuck with the following situation: I'm using an ajax call to submit a form, i use the form values to do some 'query' in django. When this happened and i got the correct queryset it delivers me an HttP response in the form of a csv. I setted up the headers and all stuff needed to get the 'save file as' window... unfortu...

How to provide SQL initial data when app label is used?

From the documentation: Django provides a hook for passing the database arbitrary SQL that's executed just after the CREATE TABLE statements when you run syncdb. You can use this hook to populate default records, or you could also create SQL functions, views, triggers, etc. The hook is simple: Django just looks for a file called...

Django download file empty

I am writing a simple function for downloading a certain file, from the server, to my machine. The file is unique represented by its id. The file is locatd corectly, and the download is done, but the downloaded file (though named as the one on the server) is empty. my download function looks like this: def download_course(request, id):...

Django one database for each application in the same project

I have a Django project that contains two applications App1 and App2 I have configured two databases DB1 and DB2 when I use python manage.py syncdb the tables corresponding to model of the two application are created in the first database How can I configure Django to make the model of the first application goes to the fir...

PHP front end and Django backend?

I need to replace the front end portion of our site with PHP that uses some Ajax calls, but the backend uses Django for db calls. I'm hesitant about using PHP and Django together, so I was wondering if anyone has experience doing so? Anything I should be aware of when integrating the two, for instance, urls that are mapped in the appli...

Uploading file, how validate the kind of file fom django Admin?

Hi guys, im trying to upload videos from django admin, but i cant see how validate upload video files and nothing more. Any idea? Thanks Sorry with my English ...

retrieving uploaded images with django's ImageField

this is the code in my models file: from django.db import models class Studio(models.Model): ..... ..... metroimage = models.ImageField(upload_to='images', blank=True) this is the code on the template file: {% for place in studio %} ..... ..... <img class="metro" src="{{ place...