Re: Running a custom function when a queryset is evaluated.

2016-10-21 Thread David Nielson
I noticed a typo in my original message: "function prefetch_employee_data(employees):" should be "def prefetch_employee_data(employees):" -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Running a custom function when a queryset is evaluated.

2016-10-21 Thread David Nielson
I'm really hitting a wall on this issue...maybe there's someone out there who has insight on this. In this application there is an Employee model with its accompanying table in the database. In order to track the "effective dates" of certain fields, I have removed those columns from the table,

Re: Deploy on Heroku Error

2016-10-21 Thread Constantine Covtushenko
Hi Aline, I thought that an initial idea of running application with `heroku local` is to check how it can run in heroku. Why did you change the Procfile in such a way? It supposed to use it the same as for heroku. Can you please try with Procfile without any local specific modifications?

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-21 Thread Andrew Chiw
As someone POSTs a questionnaire, I lookup some additional info about the IP and save that into a model's JSONField. I'm sending the request into django-ipware's get_ip(), which will return the IP address as a string. Since this data is ephemeral, I put it directly in the constructor instead of

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-21 Thread Alex Heyden
Are you intentionally sending the whole request into that constructor and concatenating it to a URL string? I can't imagine any way this doesn't end in disaster. I'm sure the community would happily help, but it's not at all obvious from the supplied code what you're trying to do here. On Fri,

Re: How to: Django development and debugging

2016-10-21 Thread Muizudeen Kusimo
Hello Folks, PyCharm makes debugging Django (and other Python) applications very easy. Some of the features which are very helpful include: 1. Ability to choose specific Python Interpreter you want to run the code base against. Useful if you use virtualenv and need to test your code

Re: Django 1.8: Existing Migrations Files Erroring After FK Model Removed

2016-10-21 Thread Tim Graham
It might be that you've made a mistake such as importing a model for RunPython rather than using apps.get_model(). Could you share the traceback? On Friday, October 21, 2016 at 7:18:05 AM UTC-4, dy...@dylan-jenkinson.nz wrote: > > Hi there, > > In one of our projects we have removed an old

Class.object.filter does not work properly after project migration from django 1.6 to 1.8.

2016-10-21 Thread Ladislav Michlíček
Hello, project was written in django 1.6 and recently migrated to django 1.8.15. It works quite well but project tests showed a failure during executing line: objs = Agent.objects.filter(Q(first_name__icontains=term) | Q(last_name__icontains=term) | Q(accord_id__icontains=term) |

Django 1.8: Existing Migrations Files Erroring After FK Model Removed

2016-10-21 Thread dylan
Hi there, In one of our projects we have removed an old model that was no longer used. It was used as a FK on a couple of other models, so there are old migrations that have the model in them. I am trying to migrate into a fresh new DB to do some new work on the app. The migrations proceed

Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-21 Thread Andrew Chiw
In my views, I have this: def questionnaire(request): def save_the_lead(cleaned_data, ipinfo): email = cleaned_data.pop('email', None) lead, created = Lead.objects.update_or_create(email=email) lead.q = cleaned_data lead.ipinfo = ipinfo lead.save()

Re: Tutorial part 4 help: the raidio buttons to make a choice on the polls question won't show.

2016-10-21 Thread Othniel Ayinzat
I think the problem is from around: {% for choice in question.choice_set.all %} {{ choice.choice_text }} {% endfor %} This is because i tested outside the loop and i got the radio button, but the whole idea was to loop through the questions and assign a button for the choices. -- You

Re: Deploy on Heroku Error

2016-10-21 Thread Aline C. R. Souza
Hello, Constantine, I have already followed this article and using `heroku local` the app runs fine. However, some things I did different: (i) I used psycopg2==2.6.2 instead of psycopg2==2.5.3, because the 2.5.3 version do not works with Visual Studio Community 2015. (ii) On my Procfile I put:

Re: Deploy on Heroku Error

2016-10-21 Thread Aline C. R. Souza
Hello Antony, This is the link to the Poll App: https://github.com/alinecrsouza/django-polls-app The changes I made on the imports (change to polls.models instead of .models), I made directly on my virtualenv, I didn't change the polls app code. I was afraid of losing some of my previous work

Re: Deploy on Heroku Error

2016-10-21 Thread Constantine Covtushenko
Hi Aline, I have encountered the problem described by you as well. I am using heroku for about 5 django projects. For some reason this problem does not exist when you run django server with manage.py command. Try to read that heroku