Re: a variable is not defined

2019-10-18 Thread Joalbert Palacios
Not sure, but I believe that is because scope, given that result variable is defined in the inner method and not defined in search function. On Fri, Oct 18, 2019, 3:49 PM sotiris moustogiannis wrote: > thanks for your help!! > > On Friday, October 18, 2019 at 6:59:05 AM UTC+3, jlgimeno71 wrote:

Re: a variable is not defined

2019-10-18 Thread sotiris moustogiannis
thanks for your help!! On Friday, October 18, 2019 at 6:59:05 AM UTC+3, jlgimeno71 wrote: > > I saw this that may be relevant: > > > https://stackoverflow.com/questions/7576202/how-can-i-pass-two-models-to-a-class-based-generic-view > > -Jorge > > On Thu, Oct 17, 2019 at 8:14 PM sotiris moustogian

Re: a variable is not defined

2019-10-17 Thread Jorge Gimeno
I saw this that may be relevant: https://stackoverflow.com/questions/7576202/how-can-i-pass-two-models-to-a-class-based-generic-view -Jorge On Thu, Oct 17, 2019 at 8:14 PM sotiris moustogiannis wrote: > I want to make custom function because i want to take one result from 2 > different models

Re: a variable is not defined

2019-10-17 Thread sotiris moustogiannis
I want to make custom function because i want to take one result from 2 different models (inner join), and i dont find a way to use 2 models in my listview class (generic) On Friday, October 18, 2019 at 6:03:18 AM UTC+3, sotiris moustogiannis wrote: > > I read that you can't use the def get_que

Re: a variable is not defined

2019-10-17 Thread sotiris moustogiannis
I read that you can't use the def get_queryset into a function but only in a generic class view, so maybe the def get_queryset function does not run. I want to make my own custom function and i want to find a way to get self parameter in my function. Thanks a lot. On Friday, October 18, 2019 a

Re: a variable is not defined

2019-10-17 Thread Jorge Gimeno
wd, The problem here is that when you're creating the context, the name 'result' is not defined. When the get_queryset() method returns, the result name goes out of scope. My guess that's why you're getting a NameError. If that's not it, I would suggest cutting and pasting the traceback and show

Re: a variable is not defined

2019-10-17 Thread wd
oh ,sorry my mistake. But I think the error is pretty clear ... On Fri, Oct 18, 2019 at 10:23 AM wd wrote: > Dude, you need to indent at the line include 'context' ... it's a > beginners problem... > > On Fri, Oct 18, 2019 at 10:14 AM sotiris moustogiannis < > sotom...@outlook.com> wrote: > >>

Re: a variable is not defined

2019-10-17 Thread wd
Dude, you need to indent at the line include 'context' ... it's a beginners problem... On Fri, Oct 18, 2019 at 10:14 AM sotiris moustogiannis wrote: > I have an error: name 'result' is not defined > > > > def search(request): > > def get_queryset(self): > query = self.request.GET.ge