Re: formset - how to set a from error from formset.clean?

2015-01-29 Thread Richard Brockie
Following up - this did the trick. Thanks for the pointer. R. On Mon, Jan 19, 2015 at 10:40 AM, Richard Brockie wrote: > Thank you - that looks like what I am looking for! I don't know how I > missed that. > > I'm on 1.6 right now - another reason to move to 1.7 :) > > R. > > On Mon, Jan 19, 201

Re: Accessing Django test client in setUpClass

2015-01-29 Thread Fred Stluka
Nicole, If you can't access self.client of TestCase, you can always allocate one yourself as: c = Client() See details in: - http://www.dougalmatthews.com/2010/Jan/20/testing-your-first-django-app/ --Fred Fred Stluka

Namespace url lookup inside template of an app

2015-01-29 Thread Thorsten Sanders
Hello, writing currently an app which should show different things based on namespace which is working already, but I do have problems with generating the right url inside the templates of that app. I tried to use: {% url 'myaddons:index' %} but that always shows the same namespace url the las

Re: Django web hosts in Canada

2015-01-29 Thread Avraham Serour
look for a vps and not a shared hosting, something like what you would get with AWS on the downside you will need to do everything yourself (installing and configuring all the libraries, updating the server etc) on the plus side it will be more flexible, it will support anything you would like O

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Vijay Khemlani
yep, it's safe to do so On Thu, Jan 29, 2015 at 3:40 PM, Tobias Dacoir wrote: > Thanks for answering all my questions. > > So it's perfectly save to call the save method at a later time? As long as > I keep the object and a pointer to it in memory I can freely modify it in > several Functions be

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Tobias Dacoir
Thanks for answering all my questions. So it's perfectly save to call the save method at a later time? As long as I keep the object and a pointer to it in memory I can freely modify it in several Functions before finally calling save at some point in time? -- You received this message because

Re: When do I have to call save() on a Model Instance?

2015-01-29 Thread Vijay Khemlani
You could pass the user as an optional parameter to function2. Whether you should save the user or not in each of the methods depends on the logic of your application, or you can add a parameter to the method (True to save the object, False otherwise) On Thu, Jan 29, 2015 at 1:43 PM, Tobias Dacoi

When do I have to call save() on a Model Instance?

2015-01-29 Thread Tobias Dacoir
I want to reduce the database queries, imagine I have a case like this: def function1(): user = User.objects.get(id=1) user.name ="Myself" function2() function3(user) user.save() def function2(): user = User.objects.get(id=1) user.lastname = "private" def func

Django web hosts in Canada

2015-01-29 Thread jogaserbia
Hi All, I would like to deploy my first Django website in the next month or so. I am looking at deployment options, but need some clarification. 1) when id doesn't matter where the servers are I understand that in terms of PASS: heroku, AWS, and Google elastic beanstalk can all handle Django

sql query to annotation values e aggretate statements

2015-01-29 Thread Mauro Ziliani
Hi all. My name's Mauro and I start to work with Django 1.7.3 I work on my project which tracks my accounting. I need to translate a SQL query to annoteta values aggretate statements. The application is named accounting The models involved are: class Nominativo(models.Model): nome = models.C

Re: Best way to get ForeignKey Related Objects?

2015-01-29 Thread Vijay Khemlani
Python has higher order functions, so you can do things like this m = pair.answers # m refers to the method itself print m# Prints "method AudioQuestionPair.anwers of ..." answers = m() # Actually executes the method On Thu, Jan 29, 2015 at 11:20 AM, Tobias Dacoir

Re: Best way to get ForeignKey Related Objects?

2015-01-29 Thread Tobias Dacoir
Damn, you are right. pair.answers() works. I'm wondering why I didn't get a syntax error when calling it without the parenthesis (), because print still worked. On Thursday, January 29, 2015 at 2:59:56 PM UTC+1, Vijay Khemlani wrote: > > "answers" seems to be a method on the AudioQuestionPair cl

Re: Best way to get ForeignKey Related Objects?

2015-01-29 Thread Vijay Khemlani
"answers" seems to be a method on the AudioQuestionPair class, so your call should be: for answer in pair.answers(): print answer and "pair.answers.get.all()" does not make sense sinse "answers" is a method. If you don't want to use a specific method, you can do this: answers = pair.answer_

Best way to get ForeignKey Related Objects?

2015-01-29 Thread Tobias Dacoir
I have two Models as shown below. Now when I have a specific AudioQuestionPair and I do something like print pair.answers it works just fine. However I can not do: for answer in pair.answers Using pair.answers.get.all() does also not work. So I have to do answers = Answer.objects.filter(

Re: Putting picture thumbnails within admin page

2015-01-29 Thread Collin Anderson
Hi, Any luck? Try looking at the Network tab of the developer console to see what the errors are. Collin On Monday, January 26, 2015 at 7:31:54 PM UTC-5, bradford li wrote: > > > I am trying to put thumbnail pictures of my photos within my admin page. I > am currently running into the issue w

merge django.po and djangojs.po files

2015-01-29 Thread gipyth
Hi, I want to keep the one language file for all extensions. But I can parse the js files only with django-admin makemessages -d djangojs -l it command. django-admin makemessages -d django -l it -e js does not work for me. I have Python 2.7.8, Django 1.7, gettext-runtime-0.17, gettext-tools

Re: Disorientated by too many google-maps django packages

2015-01-29 Thread Victor
Many thanks to Mario Goodelj for the very clear example and his explanations. Ciao Vittorio Il giorno 27/gen/2015, alle ore 00:12, Mario Gudelj ha scritto: > Hey Victor, > > Here's some basic JS I've used in a project to plot client locations, and to > show their name and phone when the marker

Re: Forms test run on development database instead of test database

2015-01-29 Thread Merouane Atig
Thank you for the explanation. So I suppose a better way to do it whould be to provide initialize the choices in the DomainForm __init__? Le mardi 27 janvier 2015 21:58:56 UTC+1, Collin Anderson a écrit : > > Hi, > > I just tried out your project. Looking at the stacktrace, the test module > is

upload_to for ImageField changes name of file being uploaded

2015-01-29 Thread bradford li
I posted a question on stackoverflow regarding my issue: http://stackoverflow.com/questions/28205560/upload-to-value-changes-photo-name-attribute Basically upload_to value will change my ImageField.name to the upload_to value -- You received this message because you are subscribed to the Googl

Re: sending email

2015-01-29 Thread James Schneider
Couple things. I think the return statement for thankyou.html needs to get kicked in a tab, otherwise the form will show successful every time the form is submitted, even if it had errors.If there are errors, it will also skip your email code, but still show as successful. This line is very confu