Executing validation on entry to class-based views

2013-09-25 Thread Darren Spruell
Greetings, I have an app with a CBV for the main functionality that I'd like to do some validation on config settings (in settings.py) before carrying out the view. My particular view in this case is a FormWizard, but I'd like to know general to any CBV; what is the correct pattern for doing this

How to do 2-ModelForm-in-1-CVB right?

2013-09-25 Thread Adam
Hi, I am trying to handle 2 ModelForm in 1 view. Is that possible with CBV solution? Does any best practise exist? Here is the problem in details. ## models.py class UserProfile(HasJPAddresses, models.Model): user = models.OneToOneField(User) birthdate = models.DateField(default='1900

Re: Restrict access to user-uploaded files to authorized users

2013-09-25 Thread m1chael
I think Xsendfile is what you want On Wed, Sep 25, 2013 at 12:51 PM, Mattias Linnap wrote: > > Are there any obvious solutions that I have over looked? Or am I stuck > having to use django to serve the files? > > Depending on the security that you aim to achieve, one option would be to > add a

Re: Recommended dev environment for a Django project deployed to Linode

2013-09-25 Thread Cal Leeming [Simplicity Media Ltd]
+1 for virtualenvwrapper, don't know how I survived without this!! Cal On Wed, Sep 25, 2013 at 9:59 PM, Roberto López López wrote: > > Check virtualenvwrapper > > http://virtualenvwrapper.readthedocs.org/en/latest/ > > > > > On 09/25/2013 08:06 PM, Jorge Arevalo wrote: > > Fine. I don't think m

Re: Recommended dev environment for a Django project deployed to Linode

2013-09-25 Thread Roberto López López
Check virtualenvwrapper http://virtualenvwrapper.readthedocs.org/en/latest/ On 09/25/2013 08:06 PM, Jorge Arevalo wrote: > Fine. I don't think my boss is going to pay for PyCharm license, so > I'll probably go for Eclipse now (I don't really like it too much, but > if works, it's ok for me) >

Re: Recommended dev environment for a Django project deployed to Linode

2013-09-25 Thread Vernon D. Cole
Yes, I like to have three levels, too. I call the middle one "staging". You can tear it down and build it up again as many times as needed to get it right. A ten-year-old PC will work fine for staging practice. Blow the dust out (the dust affects cooling and leads to poor reliability), load Ubunt

Re: Recommended dev environment for a Django project deployed to Linode

2013-09-25 Thread Bill Freeman
I guess that it's what you're used to. I'm perfectly happy with emacs (less so with vi or vim, but still happy enough). I'm happy with emac's python mode, css mode, etc. There's even supposed to be help for Django templates now. I'm using the Espresso add-on for JavaScript. It's not everything

Re: Not able to create an simple application using DB (syncdb error)

2013-09-25 Thread Bill Freeman
And where is your settings.py file? If it is in the same directory as manage.py, and it is a reasonably current Django (1.4, 1.5), then it's in the wrong place. It belongs in a sub-directory named 'blog1', along with your urls.py, wsgi.py and an empty __init__.py . On Wed, Sep 25, 2013 at 1:40

Re: Not able to create an simple application using DB (syncdb error)

2013-09-25 Thread Roopa singh
Can you please check this thread http://stackoverflow.com/questions/12987648/importerror-could-not-import-settings . On Wed, Sep 25, 2013 at 11:10 PM, s. gulab wrote: > When i give " ./manage.py syncdb " i am getting following error. > > " *Traceback (most recent call last):* > * File "manage.

IntegrityError with proxy model but not with parent?

2013-09-25 Thread Derek
I am working with a proxy model that does not seem to work with the 'unique_together' of the model being proxied. What I have is: class Parent(Model): id = AutoField(primary_key=True) name = CharField() stuff = CharField() class Meta: ordering = ['name'] unique_to

Re: Recommended dev environment for a Django project deployed to Linode

2013-09-25 Thread Jorge Arevalo
Fine. I don't think my boss is going to pay for PyCharm license, so I'll probably go for Eclipse now (I don't really like it too much, but if works, it's ok for me) About virtualenv, is there any method to provide something like a script to create a virtualenv, install the needed software and h

Re: Recommended dev environment for a Django project deployed to Linode

2013-09-25 Thread Jorge Arevalo
Hello, First of all, many thanks for your response. Sorry for the delay answering this. I was in a business trip. So, you basically have 2 environments: your own machine, and the Linode box. You make the development and testing in your machine, and Linode is for production purposes. And you c

Re: Aggregation and count - only counting certain related models? (i.e. adding a filter on the count)

2013-09-25 Thread Simon Charette
I assumed the OP wanted to get *all* instances of Item even if they don't have any liked status equals to 'L'. The query you provided will filter out instances of Item with `itemlikestatus__count < 1` instead of returning an annotated value of 0. Le mercredi 25 septembre 2013 04:41:37 UTC-4, Da

Not able to create an simple application using DB (syncdb error)

2013-09-25 Thread s. gulab
When i give " ./manage.py syncdb " i am getting following error. " *Traceback (most recent call last):* * File "manage.py", line 10, in * *execute_from_command_line(sys.argv)* * File "c:\Python27\lib\site-packages\django\core\management\__init__.py", line* *453, in execute_from_command_line

Re: Restrict access to user-uploaded files to authorized users

2013-09-25 Thread Mattias Linnap
> Are there any obvious solutions that I have over looked? Or am I stuck having to use django to serve the files? Depending on the security that you aim to achieve, one option would be to add a custom file storage implementation that overrides https://github.com/django/django/blob/master/django/c

"original" not set in admin template django/contrib/admin/templates/admin/submit_line.html after upgrade

2013-09-25 Thread Gloria W
Hi all, I recently upgraded a site from 1.4 to 1.5.4, and it seems like in the submit_line template, "original" is not set. This line fails for that reason: {% if show_delete_link %}{% trans "Delete" %}{% endif %} The template chain at this point is so nested that it's hard to figure out wher

Server-side validation for complex ajax forms

2013-09-25 Thread Mattias Linnap
Hi all, I have been asked to build a single-page, ajax based data entry interface for a moderately complex set of models. There are 5 models, linked into a tree structure by foreign keys. The number of children for each model is variable, so there could be up to 4 levels of nested formsets. I can

Re: Restrict access to user-uploaded files to authorized users

2013-09-25 Thread Michael Fladischer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2013-09-24 22:53, J Y wrote: > Are there any obvious solutions that I have over looked? Or am I > stuck having to use django to serve the files? If you have deployed through mod_wsgi: Just serve the files through Apache but restrict access by hav

wrong data on save

2013-09-25 Thread elia chiesa
Hi all, I have this change list in admin. On this list I can edit two fields inline. Problem is, on save, in overridden method "save_model(self, request, obj, form, change)", when I check for data integrity, sometimes values of these two fields from post, form and model differ. When it happens,

View videos

2013-09-25 Thread Hélio Miranda
Good. I have a problem that does not really know how to solve. It is this: I have my server-client application. On the server I'm using django with tastypie. My problem is this, I'm uploading videos (where I am entering these videos in GridFS, file system mongodb), now I wonder how do I show the

Re: Template Syntax Error

2013-09-25 Thread SHANTANU SRIVASTAVA
Thanks ! The urls.py can be viewed here : http://dpaste.com/hold/1394929/ On Tuesday, September 24, 2013 1:10:57 AM UTC+5:30, Alagappan Ramu wrote: > > Looks like the is an issue in Django being able to resolve URLs in your > application. Can you paste your urls.py for more info. > > > Regards,

Re: Aggregation and count - only counting certain related models? (i.e. adding a filter on the count)

2013-09-25 Thread Daniel Roseman
On Tuesday, 24 September 2013 21:58:44 UTC+1, Simon Charette wrote: > Unfortunately the Django ORM's doesn't support conditionnal > aggregates > . > This is true, but completely irrelevant to the OP's question, which doesn't require them. The docume