Re: splitting models.py

2012-08-08 Thread Mike Dewhirst
On 8/08/2012 6:10pm, Russell Keith-Magee wrote: On Wed, Aug 8, 2012 at 3:27 PM, Mike Dewhirst wrote: I would like to understand the "formula" for splitting a monolithic models.py into ./models/.py files. Can someone point to somewhere in the docs or source which sets

Re: formeset choicefield dynamic choices

2012-08-08 Thread Melvyn Sopacua
On 8-8-2012 15:32, BiG-Up wrote: > I'm working on a formset with dynamic forms. I've overloaded my form > to be able to add new values in the select field but i cannot > overload the formset constructor. Django raise exception : > "__init__() takes exactly 1 argument (2 given)"

Created & updated date/time in models

2012-08-08 Thread Lachlan Musicman
Hola, I've got a bunch of date dependent data that I will need to analyse as the years go by. So adding create_date and update_date fields seems like the thing to do. I go researching I and I see that there are debates about whether auto_now_add and auto_now are useful or whether they should be

Re: Dynamically adjusting STATIC_URL depending on http or https requests?

2012-08-08 Thread Mark Gemmill
Nik, You are absolutely right, that's the ticket. Of course, given that I'm not serving the static media from a sub domain, I can can also just use a relative url as well (STATIC_URL = '/static/'). Setting up the main/http vs. admin/https redirects/rewrites on the webserver (first time I've

Admin custom widget and add new button

2012-08-08 Thread Leonardo Giordani
Hi all, I'm trying to enhance a form in the admin site for a given model (Django 1.3). The relevant part of the model is the following class Project(models.Model): [...] icon = models.ForeignKey(Icon, null=True) [...] and the admin is a simple call to admin.site.register(). This way I get

Re: Separate file stream from request input stream while upload

2012-08-08 Thread Javier Guerra Giraldez
On Wed, Aug 8, 2012 at 3:05 AM, Russell Keith-Magee wrote: > Not really. This isn't something that's Django specific -- it's a > general problem with web browsers. Web browsers make requests. > Background requests are still requests, and they need to happen in the >

Re: Dynamically adjusting STATIC_URL depending on http or https requests?

2012-08-08 Thread Nikolas Stevenson-Molnar
You could use a schemeless URL for STATIC_URL. E.g: STATIC_URL = "//static.yourdomain.com" _Nik On 8/6/2012 3:53 PM, Melvyn Sopacua wrote: > On 6-8-2012 17:56, Mark Gemmill wrote: >> I am not sure how that would work. Remember, this is a single instance of >> django - i.e. I'm not running the

formeset choicefield dynamic choices

2012-08-08 Thread BiG-Up
Hi, I'm working on a formset with dynamic forms. I've overloaded my form to be able to add new values in the select field but i cannot overload the formset constructor. Django raise exception : "__init__() takes exactly 1 argument (2 given)" - How can i change the way the formset_factory build

Re: object.create speed, creating 3 objects takes 1 sec in sqlite

2012-08-08 Thread Ivo Marcelo Leonardi Zaniolo
A agree with you, Cal. Migrate to another DB engine could not solve the problem. I just mentioned that, cause there another good opportunities. But it doesn't mean that will be easy and cheap. Ivo Marcelo Leonardi Zaniolo +55 71 9302 3400 imarcel...@gmail.com www.informatizzare.com.br

Re: object.create speed, creating 3 objects takes 1 sec in sqlite

2012-08-08 Thread Cal Leeming [Simplicity Media Ltd]
Just to chime in again here, there are many alternatives, but don't give up on MySQL straight away. Solutions such as Cassandra, MongoDB, Hadoop clustering etc are also lovely, but they all come at a cost (whether that be additional risk, development time, performance/feature trade offs, the

Re: Separate file stream from request input stream while upload

2012-08-08 Thread Kurtis Mullins
Check out nginx. It can be configured to separately upload a file and provide a status indicator. I'm not sure if you could still retrieve the WSGI Request separately or not -- but you could always take the AJAX route like Russ suggested. On Wed, Aug 8, 2012 at 6:42 AM, Jian Chang

Re: What editor do you use for .po files?

2012-08-08 Thread wayne
A neat new tool to edit .po files ( gettext ) is http://poeditor.com/. It’s online, free and very easy to use. It also permits collaborative work and imports from multiple files. On Saturday, June 20, 2009 12:05:08 AM UTC+3, Joshua Russo wrote: > > I started using PoEdit but it seems to

回复: login or login_decorator issue

2012-08-08 Thread Pengfei Xue
I think what you need is a new auth backend which return a user object -- Sincerely, Pengfei Xue 已使用 Sparrow (http://www.sparrowmailapp.com/?sig) 已使用 Sparrow (http://www.sparrowmailapp.com/?sig) 在 2012年8月8日星期三,下午6:17,mapapage 写道:I > for the login I do (username must be the id field(pk)

Re: login or login_decorator issue

2012-08-08 Thread Anton Baklanov
1) i can't see in your code where you are creating some kind of session and set some cookies to save auth state between requests. 2) is it login_required from django.contrib.auth? if yes - use login from django.conrib.auth or create your own decorator to check user auth. anyway - django provides

Re: Separate file stream from request input stream while upload

2012-08-08 Thread Jian Chang
是不是可以用异步来完成? ajax upload 2012/8/8 Russell Keith-Magee > On Wed, Aug 8, 2012 at 2:42 PM, 春燕 李 wrote: > > Thanks ! > > > > In my application, I want to upload image files(such as *.iso) which > > are always large, it will take long time before the

Re: object.create speed, creating 3 objects takes 1 sec in sqlite

2012-08-08 Thread Ivo Marcelo Leonardi Zaniolo
Some years ago I got a similar problem using postgresql. To.improve the bulk performance I chose to disable all keys and indexes after bulk the data. On postgres it solved my problem, but if you need more performance, and have more than one computer, I recommend that you take a look at Cassandra,

Re: login or login_decorator issue

2012-08-08 Thread Jian Chang
what's your '@login_required(login_url='/login/')'? seems like the decorator leads to the redirection. 2012/8/8 mapapage > for the login I do (username must be the id field(pk) of an 'owners' > table and password is a field of the same table): > > def login_user(request):

Re: login or login_decorator issue

2012-08-08 Thread mapapage
for the login I do (username must be the id field(pk) of an 'owners' table and password is a field of the same table): def login_user(request): c = {} c.update(csrf(request)) state = "" if request.POST: password = request.POST.get('password') id =

Re: login or login_decorator issue

2012-08-08 Thread Anton Baklanov
On Wed, Aug 8, 2012 at 11:15 AM, mapapage wrote: > I wrote a somehow custom login that works when the user inserts his > credentials. can give us more details on how did you implement login? > He is simply redirected to a page with url: > > url(r'^(?P\d+)/$',

login or login_decorator issue

2012-08-08 Thread mapapage
I wrote a somehow custom login that works when the user inserts his credentials. He is simply redirected to a page with url: url(r'^(?P\d+)/$', 'auth.views.main', name='main'), Now that I try to add @login_decorators but I'm facing problems. For example, I have the view def

Re: splitting models.py

2012-08-08 Thread Russell Keith-Magee
On Wed, Aug 8, 2012 at 3:27 PM, Mike Dewhirst wrote: > I would like to understand the "formula" for splitting a monolithic > models.py into ./models/.py files. > > Can someone point to somewhere in the docs or source which sets out the > logic? There isn't really any

Re: Separate file stream from request input stream while upload

2012-08-08 Thread Russell Keith-Magee
On Wed, Aug 8, 2012 at 2:42 PM, 春燕 李 wrote: > Thanks ! > > In my application, I want to upload image files(such as *.iso) which > are always large, it will take long time before the uploading > completed. During this time, I cannot send out other request on > current page,

Re: Choosing a Django-based CMS

2012-08-08 Thread Thomas Guettler
Am 05.08.2012 09:30, schrieb Sean O'Brian: Hi! I'm using Django CMS for a few of weeks and I like it. But there's one problem, which I already ran into: I can't extend Page model easily. I found one tutorial , but this not seem to be

splitting models.py

2012-08-08 Thread Mike Dewhirst
I would like to understand the "formula" for splitting a monolithic models.py into ./models/.py files. Can someone point to somewhere in the docs or source which sets out the logic? I have three apps in a project and one has a models.py with 18 models and various 1:n and n:m relationships

Re: Separate file stream from request input stream while upload

2012-08-08 Thread 春燕 李
Thanks ! In my application, I want to upload image files(such as *.iso) which are always large, it will take long time before the uploading completed. During this time, I cannot send out other request on current page, because a new request will refresh the current page and make the uploading