Composite OneToOneFields in Django?

2011-09-15 Thread RedBaron
I am fairly new to Django and I think I pretty much get the basic idea of ORM. However, there is a peculiar situation to which I do not see a plausible solution. I have a legacy database for which I am trying to write a Django app. The sql structure of both the tables is: mysql> describe event;

Re: logout_then_login - how to alter login_url

2008-12-15 Thread redbaron
> However, if you want to pass some extra information to the > logout_then_login function, look at the third argument in the url() call > -- the dictionary of extra parameters. You can set up the login_url > parameter there. hardcoding login_url is not the way I prefer to go. I supposed there

logout_then_login - how to alter login_url

2008-12-15 Thread redbaron
quote from official docs about logout_then_login view: "login_url: The URL of the login page to redirect to. This will default to settings.LOGIN_URL if not supplied" How to supply alternative login_url? I add logout url to urls.py: url(r'^accounts/logout/

How does django handle uploads?

2008-12-06 Thread redbaron
Trying to figure out how does django handle uploads with wsgi. My main question is about handling errors, there is no .read() operations neither in http/multiparser.py nor in uploadhandler.py wrapped in try- except. All multipart-related infrastructure relies on checking about

Re: adding with ORM is slow

2008-11-28 Thread redbaron
> cursor.execute("delete from app_country where name = %s", (name,)) > cursor.execute("insert into app_country (name) values (%s)", (name,)) > > this is 5x faster than work with ORM. 1. Replace it with single update statement. 2. Do you use transactions? Like

Re: Implement file upload in admin interface

2008-11-28 Thread redbaron
My current solution is. 1. Define new model Batches: class Batches(models.Model): batchfile = model.FileField(upload_to="noop") 2. In admin.py define new form with custom validators: class BatchUploadForm(forms.ModelFormi): class Meta: model = Batches def

Re: Implement file upload in admin interface

2008-11-28 Thread redbaron
I try to implement same thing.I need some place where I could upload file, django should parse it and populate database with new data. To make it more ease I defined new model BatchUpload with only one field batch. Now I need to customize upload handler method in admin site. Could anyone give