Re: cookiecutter-django installation

2016-08-01 Thread Constantine Covtushenko
Hi Gary, It is not clear what errors you have gotten. Can you please describe them? I am not using Eclipse any more so can not reproduce you problem by my own. But all should be run without problem On Mon, Aug 1, 2016 at 11:14 PM, Gary Roach wrote: > I am having

Re: Query annotation with date difference

2016-08-01 Thread Constantine Covtushenko
Hi, I am not cleat of what you suggested as a dictionary method and how you are going to use it. But any way let me check my guesses and I will be back. On Mon, Aug 1, 2016 at 11:25 PM, Yoann Duriaud wrote: > Thanks for the tip, but besides defining the type of the

Move python loop to ORM query and fix FieldError in ORM query using Conditional Expressions

2016-08-01 Thread Aditya Saraf
Hi, I have the following models defined: from django.db import models class IssuedCard(models.Model): plan_type = models.CharField(max_length=255)# This is actually a ForeignKey apn = models.CharField(max_length=255) # This is actually a Choice #

Re: selectively requiring login

2016-08-01 Thread Michal Petrucha
On Mon, Aug 01, 2016 at 10:12:53PM +0200, ludovic coues wrote: > The session cookie ? > > Or you could use another decorator or a middle-ware doing > authentication based on the ip and some information passed as get > argument. Like a token returned by django when you auth the user. Using the IP

Re: selectively requiring login

2016-08-01 Thread Larry Martell
How do I get the session cookie from the login and then how do I pass it in the subsequent request? On Monday, August 1, 2016, ludovic coues wrote: > The session cookie ? > > Or you could use another decorator or a middle-ware doing > authentication based on the ip and some

Re: Query annotation with date difference

2016-08-01 Thread Yoann Duriaud
Thanks for the tip, but besides defining the type of the output it is unclear how this can be used to perform a date difference operation. What I would need is to convert *timezone.now()* into a date constant that can be understood by the database, whatever the database is. If I leave it as it

cookiecutter-django installation

2016-08-01 Thread Gary Roach
I am having trouble with a cookiecutter-django installation. I don't have a normal virtualenv setup because I use Eclipse IDE with PyDev plugin. This means that all of the project files are outside of the virtualenv wrapper and vrtualenv is never actually activated. My OS is Debian Linux with

Re: selectively requiring login

2016-08-01 Thread ludovic coues
The session cookie ? Or you could use another decorator or a middle-ware doing authentication based on the ip and some information passed as get argument. Like a token returned by django when you auth the user. The request hit the new decorator, the decorator notice the user isn't logged in and

selectively requiring login

2016-08-01 Thread Larry Martell
On Mon, Aug 1, 2016 at 3:03 PM, James Schneider wrote: > > > On Mon, Aug 1, 2016 at 11:33 AM, Michal Petrucha > wrote: >> >> On Mon, Aug 01, 2016 at 12:17:38PM -0400, Larry Martell wrote: >> > I have a view that is accessed both from the

Re: Search multiple fields in Django Models

2016-08-01 Thread Constantine Covtushenko
Hi Jurgens, Django is the right choice. With Django all are possible. All that you described are possible. If you need more precise answer give us more precise question. Regards, On Mon, Aug 1, 2016 at 4:21 PM, Jurgens de Bruin wrote: > Hi, > > I am new to Django, I have

[ANNOUNCE] Django 1.10 and 1.9.9 released

2016-08-01 Thread Tim Graham
Django 1.10 and a bug fix release for the 1.9 series (1.9.9) are now available: https://www.djangoproject.com/weblog/2016/aug/01/django-110-released/ With the release of Django 1.10, Django 1.9 has reach end of mainstream support. It will continue to receive security and data loss fixes for

Re: selectively requiring login

2016-08-01 Thread James Schneider
On Mon, Aug 1, 2016 at 11:33 AM, Michal Petrucha < michal.petru...@konk.org> wrote: > On Mon, Aug 01, 2016 at 12:17:38PM -0400, Larry Martell wrote: > > I have a view that is accessed both from the browser and from a > > non-browser app. The request from the non browser app come from a > >

Re: selectively requiring login

2016-08-01 Thread Michal Petrucha
On Mon, Aug 01, 2016 at 12:17:38PM -0400, Larry Martell wrote: > I have a view that is accessed both from the browser and from a > non-browser app. The request from the non browser app come from a > remote app where the user has already had to login (or they would > never get to the point where

Re: selectively requiring login

2016-08-01 Thread Larry Martell
The problem is selectively bypassing or overriding the @login_required decorator. The view is called from an endpoint that has that decorator on it. On Mon, Aug 1, 2016 at 1:52 PM, ludovic coues wrote: > You could use an alternative way to login the user, transparent to the >

Re: selectively requiring login

2016-08-01 Thread ludovic coues
You could use an alternative way to login the user, transparent to the user. Like giving a token to the app when it login. 2016-08-01 18:17 GMT+02:00 Larry Martell : > I have a view that is accessed both from the browser and from a > non-browser app. The request from the

Search multiple fields in Django Models

2016-08-01 Thread Jurgens de Bruin
Hi, I am new to Django, I have been using TurboGears for the last few years. I would like to help with regards to a multi search function. In essence I would like 1 search field/form that will search multiple fields of different datatype example user should be able to search the model/db for

selectively requiring login

2016-08-01 Thread Larry Martell
I have a view that is accessed both from the browser and from a non-browser app. The request from the non browser app come from a remote app where the user has already had to login (or they would never get to the point where they could cause the request to be sent). Is there a way to make login

Re: Testing an object

2016-08-01 Thread Neil Hunt
That was an silly basic python mistake. Doh! I just indented the method correctly and the test ran fine. Thanks a lot, ludovic :) On Monday, August 1, 2016 at 12:58:01 PM UTC+1, ludovic coues wrote: > > Look like you forget to indent the method inside your class. > > 2016-08-01 13:43 GMT+02:00

Re: Better style: from django.db import models vs from django.db.models import ...

2016-08-01 Thread Michal Petrucha
On Mon, Aug 01, 2016 at 05:09:37AM -0700, graeme wrote: > I have always imported models, and then: > > class Foo(models.Model): > bar = models.CharField(max_length=100) > > > which is what the examples in the django docs do - I copied it when I > started using Django and the habit stuck. >

Re: Better style: from django.db import models vs from django.db.models import ...

2016-08-01 Thread ludovic coues
A models file might use a lot of class from the django.db.models module and importing each class lead to lengthy import line. That's might be one reason. The better reason might be that a lot of these class are named the same in django.forms and django.db.models. When you type models.CharField,

Better style: from django.db import models vs from django.db.models import ...

2016-08-01 Thread graeme
I have always imported models, and then: class Foo(models.Model): bar = models.CharField(max_length=100) which is what the examples in the django docs do - I copied it when I started using Django and the habit stuck. It is a lot less verbose to do: from models import Model, CharField

Re: Testing an object

2016-08-01 Thread ludovic coues
Look like you forget to indent the method inside your class. 2016-08-01 13:43 GMT+02:00 Neil Hunt : > I've read and reread the tutorial and I'm working on writing a very simple > banking app by copying and modifying what's in the tutorial. I've started a > new project and

Testing an object

2016-08-01 Thread Neil Hunt
I've read and reread the tutorial and I'm working on writing a very simple banking app by copying and modifying what's in the tutorial. I've started a new project and copied what was on the first two pages of the tutorial and I've written a new models file. Make migrations works okay with the