Re: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: PDF Upload

2011-05-12 Thread Amanjeev Sethi
I am still learning systems, programming and Django myself but doesn't that error look like you have not closed a previous opened File? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroup

Template inheritance, how to render dynamic content in base templates

2011-05-12 Thread robinne
How can I render dynamic content in a base template if I only call a view on my child template? What I am trying to do is setup a base template that will include "Profile" information for the user who is logged in, for example: "Welcome John", instead of "login here", on every page. But if I call

Re: Overide error messages in models

2011-05-12 Thread Shawn Milochik
On 05/12/2011 09:35 PM, Daniel França wrote: I wanna change the error messages without to need to rewrite fields code, to be more specific I want to translate them... Did you try setting the error_messages value? http://docs.djangoproject.com/en/1.3/ref/forms/validation/#using-validators The

Re: Overide error messages in models

2011-05-12 Thread Daniel França
I wanna change the error messages without to need to rewrite fields code, to be more specific I want to translate them... On Thu, May 12, 2011 at 10:25 PM, Shawn Milochik wrote: > On 05/12/2011 08:08 PM, Daniel França wrote: > >> no way? I'll need to create new model forms? >> >> 2011/5/12 Dani

Re: Overide error messages in models

2011-05-12 Thread Shawn Milochik
On 05/12/2011 08:08 PM, Daniel França wrote: no way? I'll need to create new model forms? 2011/5/12 Daniel França Hi all, I need to override error messages (like for required fields) directly in Models, I don't wanna duplicate code declaring some fields again in forms, and in some cases I don'

Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: PDF Upload

2011-05-12 Thread doniyor
Hallo, i have got small problem. i try to upload a pdf but i get this error all the time. The process can not access the file because it is being used by another process: 'file location...' my code is here: pdf_file = self.cleaned_data.get('pdf_file') if (pdf_file.name[-3:] == u'pdf' or pd

Re: Overide error messages in models

2011-05-12 Thread k4ml
On May 13, 8:08 am, Daniel França wrote: > no way? I'll need to create new model forms? > > 2011/5/12 Daniel França > > I did that for some fields in my model, and the error message still is the > > default message "This field is required". I can't see any string 'error_messages' in django/db/mo

Re: Overide error messages in models

2011-05-12 Thread Daniel França
no way? I'll need to create new model forms? 2011/5/12 Daniel França > Hi all, > I need to override error messages (like for required fields) directly in > Models, I don't wanna duplicate code declaring some fields again in forms, > and in some cases I don't even create the forms, just using gen

Overriding templates for the inclusion_tag

2011-05-12 Thread Stodge
Is there any interest in changing the inclusion template functionality to let the function return the template name in the dictionary to the inclusion_tag decorator? This would let the developer override the template filename: {{{ @register.inclusion_tag('block/render_region.html') def render_reg

File Field

2011-05-12 Thread pankaj sharma
Hello friends,. i want to upload some files to my database and show it to user .. how to add an filefield option to models.py and how to show them in admin.py. and how to let the users download the files... -- You received this message because you are subscribed to the Google Groups "Django user

Re: Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Andy
Thank you. On May 12, 6:54 pm, Kirill Spitsin wrote: > On Thu, May 12, 2011 at 03:39:39PM -0700, Andy wrote: > > Thanks. I did notice the load() method. > > > But can you tell me where is that method called? > > session[key]: > > SessionBase.__getitem__(key): >     return > self._session[key]htt

Re: Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Kirill Spitsin
On Thu, May 12, 2011 at 03:39:39PM -0700, Andy wrote: > Thanks. I did notice the load() method. > > But can you tell me where is that method called? session[key]: SessionBase.__getitem__(key): return self._session[key] http://code.djangoproject.com/browser/django/trunk/django/contrib/session

Re: Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Andy
Thanks. I did notice the load() method. But can you tell me where is that method called? On May 12, 5:39 pm, Kirill Spitsin wrote: > On Thu, May 12, 2011 at 01:58:07PM -0700, Andy wrote: > > ... > > > So basically SessionStore just creates a new instance without trying > > to look up in the data

Re: Overriding save() + site framework = nothing changed when clicking save in the admin

2011-05-12 Thread ksamuel
I got some help on the Django IRC channel: The anwser is that django save m2m relationship in the admin by calling 'clear' on it, then setting it. I means that the form destroy any attached data to the object then add the ones in you entered in the admin. It works outside the admin because we don

Re: Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Kirill Spitsin
On Thu, May 12, 2011 at 01:58:07PM -0700, Andy wrote: ... > So basically SessionStore just creates a new instance without trying > to look up in the database to see whether that session already exists > or not. But shouldn't that be the whole point of session -- for every > request Django needs to

Overriding save() + site framework = nothing changed when clicking save in the admin

2011-05-12 Thread ksamuel
I overrided the save method of one of my model to it sync its sites with its parent sites: def save(self, *args, **kwargs): ret = models.Model.save(self, *args, **kwargs) if self.id: for site in self.parent.sites.all(): self.sites.add(site.id) This code work, except

Re: Django Admin site and password field

2011-05-12 Thread Michal Petrucha
On Thu, May 12, 2011 at 09:51:24AM -0700, Gabe wrote: > First of all thx for all replies. > > For now I don`t use auth.User model I would like to create my own. So > I have written model class Users: > > [...] > > Then I have registered it in admin panel by editing admin.py among > with another

Where does SessionMiddleware load the session object from the SessionStore backend?

2011-05-12 Thread Andy
I was looking at the source code of SessionMiddleware: class SessionMiddleware(object): def process_request(self, request): engine = import_module(settings.SESSION_ENGINE) session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)

django.db.utils.DatabaseError: relation "django_content_type" does not exist

2011-05-12 Thread javatina
I have just come accross this error: django.db.utils.DatabaseError: relation "django_content_type" does not exist LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co... (see whole traceback below) Some very quick investigation showed that I am not the only one - see for exampl

Re: Encrpting urls to hide PKs

2011-05-12 Thread Ian Clelland
On Thu, May 12, 2011 at 12:29 AM, Wesley Childs wrote: > Why cant you do something like this to avoid exposing data if people are > guessing primary keys > > if request.user == Users.objects.get(id=pk-url): > Show data > Else: > raise 404 or redirect to home page > > The above requires

Re: Django Admin site and password field

2011-05-12 Thread Gabe
First of all thx for all replies. For now I don`t use auth.User model I would like to create my own. So I have written model class Users: class Users(models.Model): login = models.CharField(max_length=64,error_messages={'required':'Podanie loginu jest obowiązkowe','unique':'Podany login już i

RESTful web service unit tests

2011-05-12 Thread Bruno Ripa
Hi all, i am writing some tests to test a RESTful api i have written (Django 1.3, using piston, python 2.6.5). The url is basically: /api/products and you need to be logged to access it. We can use such api, via curl PUT query (the client code uses pycurl to access the ws). It works in produ

Help with django translation for django-sorting

2011-05-12 Thread Oleg Oltar
Hi need help, I am using django soring application: https://github.com/directeur/django-sorting I just wonder if there is a way to make local names for sorting filters... E.g. I am trying to localize following: {% anchor total Rating %} And using standard django trick {% anchor total _("Ratin

Re: Readonly on subset of forms in Admin inlines

2011-05-12 Thread Vinicius Massuchetto
Hi! Did you find any solution for this? I'm trying to achieve a similar behavior for inlines, as posted in another recent thread. Thanks. -- Vinicius Massuchetto On Jan 23, 8:07 am, Peter Phillips wrote: > Thanks for the reply! > > I probably didn't explain the problem properly. I have been usin

Re: Development server: cookies not working

2011-05-12 Thread Frederik Vogelsang
Hi, one quick update: the problem was the Set-Cookie line. I did set SESSION_COOKIE_SECURE = True in my settings.py, this is why it did not work with the localserver. Thanks everyone! Frederik -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Development server: cookies not working

2011-05-12 Thread Frederik Vogelsang
Hi, 2011/5/5 Tom Evans : > If you can see the Set-Cookie header in the responses, but your > browser is not accepting them, verify that the path and domain are > correct in that response. Browsers will ignore cookies for domains > other than the domain serving the page, and for paths other than th

Re: Interpreting html tags within a unicode string rather than simply writing them

2011-05-12 Thread Tom Evans
On Thu, May 12, 2011 at 1:13 PM, Jason <1jason.whatf...@gmail.com> wrote: > Hi there, > I have a letter stored in my database which I would like to write to a html > page preserving the formatting. The letter is standard text, however has > some non ascii characters e.g. £ $ and so on which means t

Interpreting html tags within a unicode string rather than simply writing them

2011-05-12 Thread Jason
Hi there, I have a letter stored in my database which I would like to write to a html page preserving the formatting. The letter is standard text, however has some non ascii characters e.g. £ $ and so on which means the letter takes a unicode type. In the letter I have replaced line breaks with

Re: Django Admin site and password field

2011-05-12 Thread Michal Petrucha
On Wed, May 11, 2011 at 09:58:14PM -0700, Gabe wrote: > I am using built-in Django admin. In my models.py file password field > is defined: > > password = models.CharField(max_length=64) > > I just can`t see password type field for models. It is hard for us to guess what you're actually tryi

Re: Django Admin site and password field

2011-05-12 Thread Jirka Vejrazka
I have not done it myself, but you might need to specify custom widget for your field. Take a look at PasswordInput widget here: http://docs.djangoproject.com/en/1.3/ref/forms/widgets/ HTH Jirka -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: haystack

2011-05-12 Thread Sam Lai
On 12 May 2011 17:31, pankaj sharma wrote: > > can u tell me which one is better in sphinx and haystack Haystack provides only the glue between Django and a search engine/indexer. With Haystack, you still need to pick a search engine to use, e.g. Solr, Whoosh, Xapian. It doesn't support Sphinx ye

Re: haystack

2011-05-12 Thread Tim Sawyer
Here's the instructions I wrote when I added search with Haystack and Whoosh to my site. http://drumcoder.co.uk/blog/2010/may/19/django-text-search-haystack-and-whoosh/ Hope that helps point you in the right direction. Tim. > hello friends, i want to use haystack for my website, > but i am havi

Re: Django Admin site and password field

2011-05-12 Thread Oleg Lomaka
Sorry, it's unclear you use django's auth.User model or you have custom model for your users? If you have your custom model, then show an admin.py file from your app directory. On Thu, May 12, 2011 at 7:58 AM, Gabe wrote: > I am using built-in Django admin. In my models.py file password field >

Re: CharField with choices gets no ... choices

2011-05-12 Thread Thomas Weholt
On Thu, May 12, 2011 at 10:09 AM, Jani Tiainen wrote: > On Thu, 2011-05-12 at 09:59 +0200, Thomas Weholt wrote: >> I got a model looking something like this >> >> class SomeModel(models.Model): >>     somefield = models.CharField(max_length=100, choices=somemethod()) >> >> The problem is that some

Re: CharField with choices gets no ... choices

2011-05-12 Thread Oleg Lomaka
You don't need to override choices for Model, because it is global to validate "what values accepted to store into database". It's not depends on current request scope or session. If you need to provide user with subset of choices to choose from dynamically, then you should use a Form for this. c

Re: CharField with choices gets no ... choices

2011-05-12 Thread Jani Tiainen
On Thu, 2011-05-12 at 09:59 +0200, Thomas Weholt wrote: > I got a model looking something like this > > class SomeModel(models.Model): > somefield = models.CharField(max_length=100, choices=somemethod()) > > The problem is that somemethod, which produces the choices to give in > the form in t

Re: class based views

2011-05-12 Thread km
ah! thanks - thisis what i require. regards, KM On Thu, May 12, 2011 at 1:31 PM, Michal Petrucha wrote: > On Thu, May 12, 2011 at 12:26:13PM +0530, km wrote: > > Hi all, > > > > I do not find any help page on migrating existing function based views > > (defined in views.py of django app) to class

Re: class based views

2011-05-12 Thread Michal Petrucha
On Thu, May 12, 2011 at 12:26:13PM +0530, km wrote: > Hi all, > > I do not find any help page on migrating existing function based views > (defined in views.py of django app) to class based views in django.1.3 > pointers and help appreciated. There is a migration guide, you can find it for examp

Re: class based views

2011-05-12 Thread Oleg Lomaka
http://docs.djangoproject.com/en/1.3/topics/generic-views-migration/ On Thu, May 12, 2011 at 9:56 AM, km wrote: > I do not find any help page on migrating existing function based views > (defined in views.py of django app) to class based views in django.1.3 > pointers and help appreciated. > >

CharField with choices gets no ... choices

2011-05-12 Thread Thomas Weholt
I got a model looking something like this class SomeModel(models.Model): somefield = models.CharField(max_length=100, choices=somemethod()) The problem is that somemethod, which produces the choices to give in the form in the admin, is called when the module is imported, not when the form ins

Re: haystack

2011-05-12 Thread pankaj sharma
can u tell me which one is better in sphinx and haystack On May 11, 10:01 pm, Tarkeshwar Thakur wrote: > In your settings filehttp://docs.djangoproject.com/en/dev/topics/settings/ > > On Thu, May 12, 2011 at 10:20 AM, pankaj sharma > wrote: > > > > > > > > > > > hello friends, i want to use hays

Re: Encrpting urls to hide PKs

2011-05-12 Thread Wesley Childs
Why cant you do something like this to avoid exposing data if people are guessing primary keys if request.user == Users.objects.get(id=pk-url): Show data Else: raise 404 or redirect to home page The above requires a logged in a user but you get the idea of not allowing people to start

Re: customizing admin - third party db esp. MongoDB?

2011-05-12 Thread λq
http://mongoengine.org/docs/v0.4/django.html It doesn't work with django admin's. On Thu, May 12, 2011 at 3:16 PM, Shamail Tayyab wrote: > On 12/05/11 12:13 PM, λq wrote: >> >> Hi guys, >> >> I have a legacy Django project to maintain, and now my job is to port some >> part >> of the admin view

Re: customizing admin - third party db esp. MongoDB?

2011-05-12 Thread Shamail Tayyab
On 12/05/11 12:13 PM, λq wrote: Hi guys, I have a legacy Django project to maintain, and now my job is to port some part of the admin view from MySQL backend to MongoDB. AFAIK the mongodb as Model backend for django isn't exactly mature yet, I am thinking of writing customized admin views while

filteredselectmultiple widget breaks when in dialog box

2011-05-12 Thread carrier24sg
hi folks, I am using the FilteredSelectMultiple widget for my manytomanyfield, as seen on the admin site. At the moment, everything is fine. However, if I place this widget within a jquery dialog, the script breaks. I cannot move my items from the first list to the second.