Re: TYPE ERROR at /login/: ; Help me Resolve

2020-05-23 Thread LGBS fine soul coders
Py manage. py makemigrations


On May 23, 2020 10:04, "Madhav Nandan"  wrote:

> Hello all,
>
> I was making an eCommerce web application using Django 2.X.
>
> I'm getting TYPE ERROR at /login/:
> here screenshots are attached, help me resolve issues:
>
> I did make all the required changes, however, I don't find how to get rid
> of this.
>
> for all docs, please follow this link:
>
> https://drive.google.com/open?id=1l3Y5KgzPNGaQSOS9IX5IVL-_DDRhyeM7
>
>
>
> --
> Madhav Nandan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAGXYL6K7Xd_TOabAy%2BiO%3DX%2B2NFbWUH2N9AZCVxaePrD%
> 3D1cnLPg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKNQJk78ZtJc_m%3DR_3SogZGufNDL2agBHZ_0stdkAJ4WZpMeYw%40mail.gmail.com.


Re: TYPE ERROR at /login/: ; Help me Resolve

2020-05-23 Thread Kasper Laudrup

Hi Madhav,

On 23/05/2020 09.03, Madhav Nandan wrote:

Hello all,

I was making an eCommerce web application using Django 2.X.

I'm getting TYPE ERROR at /login/:
here screenshots are attached, help me resolve issues:

I did make all the required changes, however, I don't find how to get 
rid of this.




Try to look at the actual error message. It is quite helpful and this is 
really simple. It is pointing at line 39 of your views.py where you have:


print(request.user.is_authenticated())

And telling you that a 'bool' object is not callable.

A callable object is something like a function and it does indeed look 
like you are calling is_authenticated as a function. Try this:


foo = True
foo()

TypeError: 'bool' object is not callable

Looks familiar right?

So you cannot "call" a bool object which is what you are trying to do. 
So maybe you should call it but simply test its value instead like you 
would normally do for bool objects?


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4629dc34-569a-de91-9714-ba2f5faf11a4%40stacktrace.dk.


how to use .py file function via html or css button from django template

2020-05-23 Thread THIRUMALAIVASAN K
Hi,

 i have created a site for local use and i need to run some some python 
script  when i click the button , how to do that 


i am using on raspberry  to contoll something via dashboard , so i am used 
django to create a site but i can't ontroll the GPIO pin's via website 
button 



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0f01c9a8-60fb-4597-9170-c896e18058c5%40googlegroups.com.


Re: TYPE ERROR at /login/: ; Help me Resolve

2020-05-23 Thread Ousseynou Diop
Hello Guys, the problem is that you call the authenticated method, don't do 
this.
Remove the parenthesis, print(request.user.is_autheticated)

Le samedi 23 mai 2020 07:06:08 UTC, Madhav Nandan a écrit :
>
> Hello all,
>
> I was making an eCommerce web application using Django 2.X.
>
> I'm getting TYPE ERROR at /login/: 
> here screenshots are attached, help me resolve issues:
>
> I did make all the required changes, however, I don't find how to get rid 
> of this.
>
> for all docs, please follow this link: 
>
> https://drive.google.com/open?id=1l3Y5KgzPNGaQSOS9IX5IVL-_DDRhyeM7
>
>
>
> -- 
> Madhav Nandan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/70c76ca5-af77-4683-a1e2-07512ee3f392%40googlegroups.com.


RE: how to use .py file function via html or css button from django template

2020-05-23 Thread Vishesh Mangla
You can create a .py file in the same location where your views.py file is.Then to import any function from there in the views.py you can use,from  import I rather prefer to make a folder structure like templates/ and static/ And name it backend/my_appThen inside there I store all the .py filesThen in views I usefrom .backend.my_app import module_nameSent from Mail for Windows 10 From: THIRUMALAIVASAN KSent: 23 May 2020 17:03To: Django usersSubject: how to use .py file function via html or css button from django template Hi,  i have created a site for local use and i need to run some some python script  when i click the button , how to do that   i am using on raspberry  to contoll something via dashboard , so i am used django to create a site but i can't ontroll the GPIO pin's via website button-- You received this message because you are subscribed to the Google Groups "Django users" group.To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0f01c9a8-60fb-4597-9170-c896e18058c5%40googlegroups.com. 



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ec91644.1c69fb81.c2d43.4742%40mx.google.com.


Re: TYPE ERROR at /login/: ; Help me Resolve

2020-05-23 Thread Anubhav Madhav
Exactly, django now supports is_authenticated as an attribute and not as a 
method is_authenticated().

Try is_authenticated.


On Saturday, 23 May 2020 17:29:01 UTC+5:30, Ousseynou Diop wrote:
>
> Hello Guys, the problem is that you call the authenticated method, don't 
> do this.
> Remove the parenthesis, print(request.user.is_autheticated)
>
> Le samedi 23 mai 2020 07:06:08 UTC, Madhav Nandan a écrit :
>>
>> Hello all,
>>
>> I was making an eCommerce web application using Django 2.X.
>>
>> I'm getting TYPE ERROR at /login/: 
>> here screenshots are attached, help me resolve issues:
>>
>> I did make all the required changes, however, I don't find how to get rid 
>> of this.
>>
>> for all docs, please follow this link: 
>>
>> https://drive.google.com/open?id=1l3Y5KgzPNGaQSOS9IX5IVL-_DDRhyeM7
>>
>>
>>
>> -- 
>> Madhav Nandan
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/351066d9-4eda-4a1c-9ed7-c78fa8689c9b%40googlegroups.com.


Additional column in Queryset with condition

2020-05-23 Thread Saurabh Adhikary
Hello ,

I need some advice / tips.

I am in a fix.
I have 2 databases & I want to join 2 tables of that. *As we know the 
foreign key concept with 2 separate databases is not possible. *

Basically what I want is to add a custom column to a queryset and pass the 
*current row.name 
 *value to a function and that function will return 
*location*. The return value should be saved for each row individually. 
Each row will have different values. Currently, by annotate the function is 
calling but :
1) * name* values are not getting passed
2) anything returned once is saved for the entire queryset.


*Constraint - change in models is difficult for my prod environment.*

database1.table1 

database2.table1 
*name* *rating* 
*outlet* *location*
pizza hut 5 
pizza-hut Mumbai
mc donalds 4 
mc-donalds Washington

Now, I want to get *location *from database2.table1 and sort it with this 
field .

What I have tried :
1 - queryset.annotate(loc=Value('abc', output_field=CharField())) and later 
updating the queryset.  But the main queryset doesn't gets updated by each 
row of the custom column. All the values gets updated by the same value.
2 - queryset.extra(select={'loc': myfunc('*name*')}) but here the column 
values are not getting passed.
3 - queryset.extra(select={'loc': "select '*location*' from *database2*.table1 
where outlet == %s"},select_params=('*name*',)) but here the column values 
are not getting passed.


Kindly , if you can help find a solution by :
- handling the queryset in a better way
- writing a query like Count as that is working fine for a similar column 
(although I know this works on Foreign key, but still if the logic is 
helped how to write Count type of function I can write my own snippet)


Regards,
Saurabh Adhikary

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c2447190-9a56-4abb-b554-41dab35ec4c9%40googlegroups.com.


Re: Postgresql and mysql

2020-05-23 Thread Ram
Hello Salima,

You could use the COPY command that is documented here.

https://www.postgresql.org/docs/current/static/sql-copy.html

But if the data is bulk and that data has to be copied or inserted into the
table in a faster manner, your ideal solution is *Pgloader *because of its
performance benefits.

https://pgloader.readthedocs.io/en/latest/index.html

HTH,
~Ram




On Mon, May 18, 2020 at 5:50 AM Salima Begum 
wrote:

> Hi ,
> Mysql query which we used previously now we moved to postgresql,
> Here is the below query in mysql , Can anyone help me to write
> similar query in postgresql.
>
> query = "LOAD DATA LOCAL INFILE '41098_category_list.txt' INTO TABLE
> pages_rim_ls_categories FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'
> "
>
> Thanks
> ~salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bnNUZ0XK%3DBbnwhNrEcVEe6Lpab0uazxvXtskZcR_MZ2uA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F3v07erYQF2Wr5B2rqD5Htv3D23crL1e%3D5B1gLLCG3m%2BA%40mail.gmail.com.


Re: Postgresql and mysql

2020-05-23 Thread Sebastian Jung
Hey you can Import Files on a Terminal with sudo -u postgres psql < File.txt

Salima Begum  schrieb am Mo., 18. Mai 2020,
13:50:

> Hi ,
> Mysql query which we used previously now we moved to postgresql,
> Here is the below query in mysql , Can anyone help me to write
> similar query in postgresql.
>
> query = "LOAD DATA LOCAL INFILE '41098_category_list.txt' INTO TABLE
> pages_rim_ls_categories FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'
> "
>
> Thanks
> ~salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bnNUZ0XK%3DBbnwhNrEcVEe6Lpab0uazxvXtskZcR_MZ2uA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9myhW8yn-isEEn1oW9vSUUELpL6GaDbpb-6EWWFKEsnMWw%40mail.gmail.com.


Re: TYPE ERROR at /login/: ; Help me Resolve

2020-05-23 Thread Madhav Nandan
Thanks guys.

On Sat, May 23, 2020 at 8:14 PM Anubhav Madhav 
wrote:

> Exactly, django now supports is_authenticated as an attribute and not as a
> method is_authenticated().
>
> Try is_authenticated.
>
>
> On Saturday, 23 May 2020 17:29:01 UTC+5:30, Ousseynou Diop wrote:
>>
>> Hello Guys, the problem is that you call the authenticated method, don't
>> do this.
>> Remove the parenthesis, print(request.user.is_autheticated)
>>
>> Le samedi 23 mai 2020 07:06:08 UTC, Madhav Nandan a écrit :
>>>
>>> Hello all,
>>>
>>> I was making an eCommerce web application using Django 2.X.
>>>
>>> I'm getting TYPE ERROR at /login/:
>>> here screenshots are attached, help me resolve issues:
>>>
>>> I did make all the required changes, however, I don't find how to get
>>> rid of this.
>>>
>>> for all docs, please follow this link:
>>>
>>> https://drive.google.com/open?id=1l3Y5KgzPNGaQSOS9IX5IVL-_DDRhyeM7
>>>
>>>
>>>
>>> --
>>> Madhav Nandan
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/351066d9-4eda-4a1c-9ed7-c78fa8689c9b%40googlegroups.com
> 
> .
>


-- 
Madhav Nandan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGXYL6%2BsJj1JQyizEOBZmRT1FXyuZLFzwFDSenKMmWTCpSv0Sg%40mail.gmail.com.