Password Reset

2020-01-09 Thread Soumen Khatua
Hi Guys,
In Django we have some inbuilt class for password rest and confirmation.
But In Django rest framework ,How can I do that?

Please share any code snippet or link.

Thank you in advance

Regards,
Soumen

-- 
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/CAPUw6WaBY4fZGP0ZOPjQi0Jffwgbd_ckRq9zc%3DhpUQmLFjL6eQ%40mail.gmail.com.


Re: Business Opportunity

2020-01-09 Thread Anh Nguyen
Hi, im working with python ~5 years mostly in django.
Iam interesting.
Please send more info.

On Wed, Jan 8, 2020 at 22:17 Philani Mthembu  wrote:

> Hi, All
>
> I am a co-founder for Digital Tech Proz (Pty)Ltd, It's a startup web
> development agency, I am looking for an experienced programmer to work with
> my company to develop web apps, Mobile apps, and website development.
>
> You must be experienced working with Django, PHP, Laravel, HTML5,
> Bootstrap, MySQL database, and Java
>
> This is not a job offer but a business opportunity with the potential to
> make a minimum of $18 000 for the first year, with a 20% increase annually.
>
> Requirements :
> 1. Own a Laptop or computer with a webcam.
> 2. Be on skype
> 2. Have a reliable internet connection.
> 3. Fluent in English, verbally and written communication.
> 4. Good understanding of Django, PHP, Java (Compulsory).
> 5. Have Bitcoin Wallet or Paypal account to receive your payment.
>
> For more information, kindly reach out to me on my email:
> philanimt...@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/c168e1f5-dd14-4a30-be57-c21bbc21ffdd%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/CAKaoNbSesbeist-4upNraoOyv6zoXRGRKxVybZGs%2BPaA_6yUPw%40mail.gmail.com.


Re: How do I make my webhook object run a websocket function?

2020-01-09 Thread Jeremy Wai
going to answer my own question for the sake of anyone who runs into things 
while learning python:

I needed channel redis that can pass messages from one process to another. 
redis is just a key/value storage server that you can install in ubuntu.

On Wednesday, January 8, 2020 at 8:22:11 PM UTC-8, Jeremy Wai wrote:
>
> I got a heroku server running on one web processing, in the routing.py I 
> have
>
> application = ProtocolTypeRouter({
> 'websocket': backEndConsumer,
> 'http': frontEndConsumer,
> })
>
> my frontEndConsumer handles the http webhook requests and my 
> backEndConsumer handles all my websocket requests.
>
> When a device with the correct address tries to talk to my websocket, it 
> will go to backEndConsumer and run the websocket_connect()
> Then on my frontEndconsumer, It will get a http_request().
>
> I want this http_request() to trigger the backEndConsumer to do a 
> websocket_send(). I can't seem to get that to work.
>
> webhook.py
> scope = None
> import myapp.consumers
>
> class frontEndConsumer(AsyncHttpConsumer):
> async def http_request(self, request):
> 
> myapp.consumers.backEndConsumer.frontSend(myapp.consumers.scope)
> await self.send_response(200, b"finished",
> headers=[(b"Content-Type", b"text/plain"),])
> 
> consumers.py
>
> class backEndConsumer(AsyncJsonWebsocketConsumer):
> async def websocket_connect(self, type):
> await self.accept()
> global scope
> scope = self   # doing this to pass the object to 
> frontEndConsumer
> async def frontSend(self):
> await self.send("Hello world!")
> 
> I keep getting this error
> myapp.consumers.backEndConsumer.frontSend()
> frontSend() missing 1 required positional argument: 'self'
> I know I am doing something wrong, but I am not sure how to do what I want.
>
>
>
>
>

-- 
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/0ebae823-dcd8-40db-ab99-fc9f88109963%40googlegroups.com.


Re: Writing your first Django app, part 1¶

2020-01-09 Thread Mike Dewhirst

On 10/01/2020 1:09 pm, Garrett Wiseman wrote:


Hello Everyone, 

This may sound stupid. When people know a skill so well. Its sometimes 
hard to think someone wouldn't know the most basic information. New to 
coding write code for Arduino.


Garrett

I fully understand what you are saying. And it doesn't sound stupid. A 
friend of mine can't cook and his girlfriend said he should take a 
cooking class. He said he couldn't find one where the first lesson was 
"This is a saucepan". She left him for someone less selfish.


I'm sure lots of people will respond with all sorts of advice but I 
think you are in a valuable position because you have first impressions 
of the documentation and that's what people see when they first start 
looking. First impressions are easily forgotten once you get involved.


You should consider re-writing the documentation or a section of it 
perhaps called "Absolute beginners".


Django is open source and everyone is welcome to contribute[1]. The 
correct way to do that is by writing a ticket requesting a particular 
improvement to the docs or the software. Then you should submit your 
correction/improvement in response to the ticket. If it is considered 
valuable by the gatekeepers they will use it.


Welcome

Mike

[1] https://docs.djangoproject.com/en/dev/internals/contributing/



When your on the

  * documentation page
  o Writing your first Django app, part 1¶ .
  + Then it says "We’ll assume you have Django installed
already.
You can tell Django is installed and which version by
running the followingcommand in a shell prompt (indicated
by the $ prefix):"
 +
$  python -m django --version (

You may want to put a screenshot or explain what a shell prompt is. I 
was reading this i'm still new to learning this and I didnt know. I 
had to look it up. I know that is part of the coding find the answers 
and dealing with issues. If someone new to this. Make it easy for them 
to start. Without being stopped. Just to get the program going.


--
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/03021fc5-de84-410f-9004-208805d8543f%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/8778f4ad-379c-ca13-9b0a-5e5f96ca96d7%40dewhirst.com.au.


Writing your first Django app, part 1¶

2020-01-09 Thread Garrett Wiseman


Hello Everyone, 

This may sound stupid. When people know a skill so well. Its sometimes hard 
to think someone wouldn't know the most basic information. New to coding 
write code for Arduino. 

When your on the 


   - documentation page 
  - Writing your first Django app, part 1¶ .
 - Then it says "We’ll assume you have Django installed 
  already. 
 You can tell Django is installed and which version by running the 
following 
 command in a shell prompt (indicated by the $ prefix):"
 - 
 
 $ python -m django --version (
 
 
You may want to put a screenshot or explain what a shell prompt is. I was 
reading this i'm still new to learning this and I didnt know. I had to look 
it up. I know that is part of the coding find the answers and dealing with 
issues. If someone new to this. Make it easy for them to start. Without 
being stopped. Just to get the program going. 

-- 
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/03021fc5-de84-410f-9004-208805d8543f%40googlegroups.com.


Channel 1 and Django 2.2 compatibility

2020-01-09 Thread James
Hello guys just a quick question, I have a project running channel 1, we 
are looking at upgrading to django 2.2, does channel 1 work with django 2.2 
without upgrading to channel 2?

Cheers

James

-- 
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/b14f62fd-c8cb-4dc3-8a2a-58090ae2d56a%40googlegroups.com.


Re: System to check field change in Char Field and Text Field.

2020-01-09 Thread KONE GOMPOU LOUA ALASSANE
225 47389778
Add me in the whatsapp group

Le sam. 14 déc. 2019 à 21:44, Sudipto Ghosh  a
écrit :

> Hello everyone, I am stuck in solving an assignment. I would be grateful
> to you all whosoever can help me in this memory.
>
> I have to make a system which shows the updated text file and CharField
> are some time.
> Also, Implement a system which allows updating FileField content by an
> external party (for example invoking management command from bash or
> calling a Django API or your choice of making it accessible by an external
> party). Note: after FileField content is changed, it should notify the
> updated value of FileField and CharField.
> Please reply asap.
> Thanking You,
> Sudipto Ghosh
>
> --
> 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/d807ba07-72cc-4885-b983-0cf6b8535910%40googlegroups.com
> 
> .
>
-- 
*La meilleure façon de prédire l’avenir est de le créer. *

-- 
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/CANoHCssS052EPgRYmbv5O0zg_AxErVLX6TWoi0bcpPJEB2GdBw%40mail.gmail.com.


Re: Admin Panel

2020-01-09 Thread Motaz Hejaze
search github for vali admin panel


On Thu, Jan 9, 2020 at 9:01 PM APIJAY SHARMA  wrote:

> Can anyone help me out with good looking admin panels and how to customize
> it and if possible how to make it more reliable!!!  I am just getting
> frustrated with admin issues in most of the modules
>
> --
> 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/85c5866f-c1b6-41c6-9292-ebed9f4b96f1%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/CAHV4E-eXpE5R%3Dk%2BDWHtQau-mtu%3Drg6cupVsv-Fq9Hkepzp4SrA%40mail.gmail.com.


Re: Csrf_exempt

2020-01-09 Thread Soumen Khatua
can you tell me How Can I do that?

Is it necessary ton use csrf_exempt in APIView for login operation or
signup operation?

On Fri, Jan 10, 2020 at 12:30 AM Riyasutheen A  wrote:

> Hi,
>
> Use postman interceptor extension in your browser to get correct csrf
> token in postman as well.
>
> Thanks
>
> On Thu, 9 Jan, 2020, 11:49 PM Soumen Khatua, 
> wrote:
>
>> post method is working on browser but I'm getting the error in post man?
>>
>> On Thu, Jan 9, 2020 at 10:27 PM Integr@te System <
>> datacentral...@gmail.com> wrote:
>>
>>> Hi Sounen,
>>>
>>> Inspect this link for which type and setting you like to work with.
>>>
>>> https://www.django-rest-framework.org/api-guide/authentication/#sessionauthentication
>>>
>>> Nice.
>>>
>>>
>>>
>>>
>>> On Thu, Jan 9, 2020, 22:25 Soumen Khatua 
>>> wrote:
>>>

































 *class LoginView(APIView):# permission_classes = (AllowAny,)def
 post(self, request, format=None):data = request.dataemail =
 data.get('email',None)password = data.get('password',None)
 phone_number = data.get('phone_number')if email is not None:
 if '@' in email:try:user_obj =
 User.objects.filter(email__iexact = email)if
 user_obj.exists() and user_obj.first().check_password(password):
 # user = UserLoginSerializer(user_obj)
 user = authenticate(email = email, password = password)
 login(request, user)return
 Response({"details":"login successfully"},status = status.HTTP_200_OK)
   return Response({"details":"Please signup first"},status =
 status.HTTP_404_NOT_FOUND)except User.DoesNotExist:
 return Response(status = status.HTTP_404_NOT_FOUND,deatils =
 "user not found")elif phone_number is not None:try:
 user_obj = User.objects.filter(phone_number__iexact =
 phone_number)if user_obj.exists() and
 user_obj.first().check_password(password):email =
 user_obj[0].emailuser = authenticate(email = email,
 password = password)login(request,user)
 return Response({"details":"login successfully"},status =
 status.HTTP_200_OK)except User.DoesNotExist:
 return Response({"deatils": "user not found"},status =
 status.HTTP_404_NOT_FOUND)*


 *On Thu, Jan 9, 2020 at 8:42 PM Suraj Thapa FC >>> > wrote:*

> *Code...? *
>
>
> *On Thu, 9 Jan 2020, 8:40 pm Soumen Khatua,  > wrote:*
>
>>
>> *Hi Folks,*
>>
>> *In django rest framework,I extend the LoginApiView(APIView) but when
>> I'm passing username and password in browser it logn successfully but in
>> post man I'm getting :*
>>
>>
>>
>> *{"detail": "CSRF Failed: CSRF token missing or incorrect."}*
>>
>> *Do I need to use csrf_exempt inside APIView(post) request?*
>>
>> *If yes, then why it is working some times?*
>>
>> *Thank you in advance*
>>
>> *Regards,*
>> *Soumen*
>>
>>
>>
>>
>>
>> * -- 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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%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/CAPjsHcEfamWnYiQbK914Y0SV2whkOXFthb3ZvOjBv2aw1-GL6A%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
 

Re: Csrf_exempt

2020-01-09 Thread Riyasutheen A
Hi,

Use postman interceptor extension in your browser to get correct csrf token
in postman as well.

Thanks

On Thu, 9 Jan, 2020, 11:49 PM Soumen Khatua, 
wrote:

> post method is working on browser but I'm getting the error in post man?
>
> On Thu, Jan 9, 2020 at 10:27 PM Integr@te System 
> wrote:
>
>> Hi Sounen,
>>
>> Inspect this link for which type and setting you like to work with.
>>
>> https://www.django-rest-framework.org/api-guide/authentication/#sessionauthentication
>>
>> Nice.
>>
>>
>>
>>
>> On Thu, Jan 9, 2020, 22:25 Soumen Khatua 
>> wrote:
>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *class LoginView(APIView):# permission_classes = (AllowAny,)def
>>> post(self, request, format=None):data = request.dataemail =
>>> data.get('email',None)password = data.get('password',None)
>>> phone_number = data.get('phone_number')if email is not None:
>>> if '@' in email:try:user_obj =
>>> User.objects.filter(email__iexact = email)if
>>> user_obj.exists() and user_obj.first().check_password(password):
>>> # user = UserLoginSerializer(user_obj)
>>> user = authenticate(email = email, password = password)
>>> login(request, user)return
>>> Response({"details":"login successfully"},status = status.HTTP_200_OK)
>>>   return Response({"details":"Please signup first"},status =
>>> status.HTTP_404_NOT_FOUND)except User.DoesNotExist:
>>> return Response(status = status.HTTP_404_NOT_FOUND,deatils =
>>> "user not found")elif phone_number is not None:try:
>>> user_obj = User.objects.filter(phone_number__iexact =
>>> phone_number)if user_obj.exists() and
>>> user_obj.first().check_password(password):email =
>>> user_obj[0].emailuser = authenticate(email = email,
>>> password = password)login(request,user)
>>> return Response({"details":"login successfully"},status =
>>> status.HTTP_200_OK)except User.DoesNotExist:
>>> return Response({"deatils": "user not found"},status =
>>> status.HTTP_404_NOT_FOUND)*
>>>
>>>
>>> *On Thu, Jan 9, 2020 at 8:42 PM Suraj Thapa FC >> > wrote:*
>>>
 *Code...? *


 *On Thu, 9 Jan 2020, 8:40 pm Soumen Khatua, >>> > wrote:*

>
> *Hi Folks,*
>
> *In django rest framework,I extend the LoginApiView(APIView) but when
> I'm passing username and password in browser it logn successfully but in
> post man I'm getting :*
>
>
>
> *{"detail": "CSRF Failed: CSRF token missing or incorrect."}*
>
> *Do I need to use csrf_exempt inside APIView(post) request?*
>
> *If yes, then why it is working some times?*
>
> *Thank you in advance*
>
> *Regards,*
> *Soumen*
>
>
>
>
>
> * -- 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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%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/CAPjsHcEfamWnYiQbK914Y0SV2whkOXFthb3ZvOjBv2aw1-GL6A%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/CAPUw6WZt0_TRLF-ZaFrqJvbcejuqaD_DVD4Z1%2B%3DpZhAwPzT1fA%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, 

Admin Panel

2020-01-09 Thread APIJAY SHARMA
Can anyone help me out with good looking admin panels and how to customize 
it and if possible how to make it more reliable!!!  I am just getting 
frustrated with admin issues in most of the modules

-- 
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/85c5866f-c1b6-41c6-9292-ebed9f4b96f1%40googlegroups.com.


Re: Csrf_exempt

2020-01-09 Thread Soumen Khatua
post method is working on browser but I'm getting the error in post man?

On Thu, Jan 9, 2020 at 10:27 PM Integr@te System 
wrote:

> Hi Sounen,
>
> Inspect this link for which type and setting you like to work with.
>
> https://www.django-rest-framework.org/api-guide/authentication/#sessionauthentication
>
> Nice.
>
>
>
>
> On Thu, Jan 9, 2020, 22:25 Soumen Khatua 
> wrote:
>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *class LoginView(APIView):# permission_classes = (AllowAny,)def
>> post(self, request, format=None):data = request.dataemail =
>> data.get('email',None)password = data.get('password',None)
>> phone_number = data.get('phone_number')if email is not None:
>> if '@' in email:try:user_obj =
>> User.objects.filter(email__iexact = email)if
>> user_obj.exists() and user_obj.first().check_password(password):
>> # user = UserLoginSerializer(user_obj)
>> user = authenticate(email = email, password = password)
>> login(request, user)return
>> Response({"details":"login successfully"},status = status.HTTP_200_OK)
>>   return Response({"details":"Please signup first"},status =
>> status.HTTP_404_NOT_FOUND)except User.DoesNotExist:
>> return Response(status = status.HTTP_404_NOT_FOUND,deatils =
>> "user not found")elif phone_number is not None:try:
>> user_obj = User.objects.filter(phone_number__iexact =
>> phone_number)if user_obj.exists() and
>> user_obj.first().check_password(password):email =
>> user_obj[0].emailuser = authenticate(email = email,
>> password = password)login(request,user)
>> return Response({"details":"login successfully"},status =
>> status.HTTP_200_OK)except User.DoesNotExist:
>> return Response({"deatils": "user not found"},status =
>> status.HTTP_404_NOT_FOUND)*
>>
>>
>> *On Thu, Jan 9, 2020 at 8:42 PM Suraj Thapa FC > > wrote:*
>>
>>> *Code...? *
>>>
>>>
>>> *On Thu, 9 Jan 2020, 8:40 pm Soumen Khatua, >> > wrote:*
>>>

 *Hi Folks,*

 *In django rest framework,I extend the LoginApiView(APIView) but when
 I'm passing username and password in browser it logn successfully but in
 post man I'm getting :*



 *{"detail": "CSRF Failed: CSRF token missing or incorrect."}*

 *Do I need to use csrf_exempt inside APIView(post) request?*

 *If yes, then why it is working some times?*

 *Thank you in advance*

 *Regards,*
 *Soumen*





 * -- 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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%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/CAPjsHcEfamWnYiQbK914Y0SV2whkOXFthb3ZvOjBv2aw1-GL6A%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/CAPUw6WZt0_TRLF-ZaFrqJvbcejuqaD_DVD4Z1%2B%3DpZhAwPzT1fA%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/CAP5HUWrKP32KSfo8AM01zW0PWbgK51Fd%2B-uBaC1BKvauoDGKNA%40mail.gmail.com
> 

Re: Csrf_exempt

2020-01-09 Thread Integr@te System
Hi Sounen,

Inspect this link for which type and setting you like to work with.
https://www.django-rest-framework.org/api-guide/authentication/#sessionauthentication

Nice.




On Thu, Jan 9, 2020, 22:25 Soumen Khatua  wrote:

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *class LoginView(APIView):# permission_classes = (AllowAny,)def
> post(self, request, format=None):data = request.dataemail =
> data.get('email',None)password = data.get('password',None)
> phone_number = data.get('phone_number')if email is not None:
> if '@' in email:try:user_obj =
> User.objects.filter(email__iexact = email)if
> user_obj.exists() and user_obj.first().check_password(password):
> # user = UserLoginSerializer(user_obj)
> user = authenticate(email = email, password = password)
> login(request, user)return
> Response({"details":"login successfully"},status = status.HTTP_200_OK)
>   return Response({"details":"Please signup first"},status =
> status.HTTP_404_NOT_FOUND)except User.DoesNotExist:
> return Response(status = status.HTTP_404_NOT_FOUND,deatils =
> "user not found")elif phone_number is not None:try:
> user_obj = User.objects.filter(phone_number__iexact =
> phone_number)if user_obj.exists() and
> user_obj.first().check_password(password):email =
> user_obj[0].emailuser = authenticate(email = email,
> password = password)login(request,user)
> return Response({"details":"login successfully"},status =
> status.HTTP_200_OK)except User.DoesNotExist:
> return Response({"deatils": "user not found"},status =
> status.HTTP_404_NOT_FOUND)*
>
>
> *On Thu, Jan 9, 2020 at 8:42 PM Suraj Thapa FC  > wrote:*
>
>> *Code...? *
>>
>>
>> *On Thu, 9 Jan 2020, 8:40 pm Soumen Khatua, > > wrote:*
>>
>>>
>>> *Hi Folks,*
>>>
>>> *In django rest framework,I extend the LoginApiView(APIView) but when
>>> I'm passing username and password in browser it logn successfully but in
>>> post man I'm getting :*
>>>
>>>
>>>
>>> *{"detail": "CSRF Failed: CSRF token missing or incorrect."}*
>>>
>>> *Do I need to use csrf_exempt inside APIView(post) request?*
>>>
>>> *If yes, then why it is working some times?*
>>>
>>> *Thank you in advance*
>>>
>>> *Regards,*
>>> *Soumen*
>>>
>>>
>>>
>>>
>>>
>>> * -- 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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%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/CAPjsHcEfamWnYiQbK914Y0SV2whkOXFthb3ZvOjBv2aw1-GL6A%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/CAPUw6WZt0_TRLF-ZaFrqJvbcejuqaD_DVD4Z1%2B%3DpZhAwPzT1fA%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/CAP5HUWrKP32KSfo8AM01zW0PWbgK51Fd%2B-uBaC1BKvauoDGKNA%40mail.gmail.com.


Re: Make a Django query filter at runtime

2020-01-09 Thread Ezequias Rocha
It worked well. Many thanks.

On Wednesday, January 8, 2020 at 10:08:18 PM UTC-3, Alex Conselvan de 
Oliveira wrote:
>
> Hi Ezequias,
>
> You could use a dict:
>
> data = {
>   'name': 'John',
>   'age': 42,
> }
>
> model.filter(**data)
>
> Best Regards!
>
> Em qua., 8 de jan. de 2020 às 18:09, Ezequias Rocha  > escreveu:
>
>> Hi everyone
>>
>> I am in a doubt about creating django filters dynamically.
>>
>> All you know a filter is made by using the parameters like:
>>
>> model.filter(name='John', age=42)
>>
>> But if I can't type all fields and values at design time but at runtime 
>> how to do that?
>>
>> Best regards
>> Ezequias
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/9c843d02-235f-411f-8e83-7fea2156893b%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/8afbe5c6-e767-4773-9de4-796c16a44359%40googlegroups.com.


Re: Django Validation error

2020-01-09 Thread Soumen Khatua
what you want to modify?

On Thu, Jan 9, 2020 at 7:07 PM Wesley Montcho 
wrote:

> Hello
> Thanks for helping me
> I want to ask you something else, Should I create serializer.py  or it is
> some file I can modify
>
> Le jeu. 9 janv. 2020 à 13:59, Suraj Thapa FC  a
> écrit :
>
>> Use try catch and send  whatever response you want to send
>>
>> On Wed, 8 Jan 2020, 10:36 pm Soumen Khatua, 
>> wrote:
>>
>>>
>>> *seriazlizers.py*
>>>
>>>
>>>
>>>
>>>
>>>
>>> *email =
>>> serializers.EmailField(required=True,validators=[UniqueValidator(queryset=User.objects.all())])
>>>   phone_number = serializers.CharField(required =
>>> True,validators=[UniqueValidator(queryset=User.objects.all())])password
>>> = serializers.CharField(write_only=True,required=True,
>>>   help_text='Leave empty if no change needed',
>>>   style={'input_type': 'password', 'placeholder':
>>> 'Password'}*
>>> *) *
>>>
>>> *models.py*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> * email = models.EmailField(_('email address'), unique=True)
>>> phone_number = models.CharField(max_length=10,unique = True,
>>> blank=False,default = uuid.uuid4().hex[:8])
>>> first_name = models.CharField(_('first name'), max_length=30)last_name
>>> = models.CharField(_('last name'), max_length=30, blank=True)is_active
>>> = models.BooleanField(_('active'), default=True)is_staff =
>>> models.BooleanField(_('staff status'),default=False)date_joined =
>>> models.DateTimeField(_('date joined'), default=timezone.now)*
>>>
>>>
>>>   I already did that but I want to raise validation error that email
>>> should be unique and password should be alphanumeric character in json
>>> format?
>>>
>>> On Wed, Jan 8, 2020 at 9:44 PM Suraj Thapa FC 
>>> wrote:
>>>
 For email you can set email field in model as unique=True and the
 password should be  stored in hash..

 On Wed, 8 Jan 2020, 9:37 pm Soumen Khatua, 
 wrote:

> Hi Folk,
>
> What is the process to validate fields in django rest framework?
> like email and phone number should be unique and password should be
> alphanumeric character only.
>
> Where i need to write the logic inside serializers or views part and
> how i can do that?
>
> Thank you in advance
>
> Regards,
> Soumen
>
>
> --
> 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/CAPUw6Wb7_45-r165wg10M-w%2B6V6zOheCnEC3_chbJ-GEHRGQLA%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/CAPjsHcFKnaczwY-%3DKWqbPWrUuecv6YYWR19qPwSWmZpSYG%2BW0w%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/CAPUw6WbDFeAtOxksdOijTOidX%3DW8gzCs38fN_nXMSK%3DLFxA1cg%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/CAPjsHcHcs2ogHe6bHJt44_0saVPsR1fgug0RrQ%3D%3DEQYJRJzwHQ%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 

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-09 Thread bhushan Gupta
Hello Kasper, thanks for following up.

I installed Datetime module using pip. The module is there but still the
same error. Looks like a setup error. Here is the pip output:
asgiref==3.2.3
DateTime==4.3
Django==3.0.1
pytz==2019.3
pywin32==227
sqlparse==0.3.0
virtualenv==16.7.8
zope.interface==4.7.1

On Mon, Jan 6, 2020 at 10:10 AM Kasper Laudrup 
wrote:

> Hi Bhushan,
>
> On 06/01/2020 18.20, Bhushan Gupta wrote:
> > Recreated virtual environment – no change.
> >
>
> Inside your virtual environment, what's the output of:
>
> # pip freeze
>
> ?
>
> 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/93458dd1-54da-7978-77f6-9a4f9e7446c4%40stacktrace.dk
> .
>

-- 
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/CANo91spemsy6c-%2BeT9g%2BZWHBebcNX3p3WXDeQtfUTfeDdrEP-Q%40mail.gmail.com.


Re: Csrf_exempt

2020-01-09 Thread Soumen Khatua
*class LoginView(APIView):# permission_classes = (AllowAny,)def
post(self, request, format=None):data = request.dataemail =
data.get('email',None)password = data.get('password',None)
phone_number = data.get('phone_number')if email is not None:
if '@' in email:try:user_obj =
User.objects.filter(email__iexact = email)if
user_obj.exists() and user_obj.first().check_password(password):
# user = UserLoginSerializer(user_obj)
user = authenticate(email = email, password = password)
login(request, user)return
Response({"details":"login successfully"},status = status.HTTP_200_OK)
  return Response({"details":"Please signup first"},status =
status.HTTP_404_NOT_FOUND)except User.DoesNotExist:
return Response(status = status.HTTP_404_NOT_FOUND,deatils =
"user not found")elif phone_number is not None:try:
user_obj = User.objects.filter(phone_number__iexact =
phone_number)if user_obj.exists() and
user_obj.first().check_password(password):email =
user_obj[0].emailuser = authenticate(email = email,
password = password)login(request,user)
return Response({"details":"login successfully"},status =
status.HTTP_200_OK)except User.DoesNotExist:
return Response({"deatils": "user not found"},status =
status.HTTP_404_NOT_FOUND)*


*On Thu, Jan 9, 2020 at 8:42 PM Suraj Thapa FC > wrote:*

> *Code...? *
>
>
> *On Thu, 9 Jan 2020, 8:40 pm Soumen Khatua,  > wrote:*
>
>>
>> *Hi Folks,*
>>
>> *In django rest framework,I extend the LoginApiView(APIView) but when I'm
>> passing username and password in browser it logn successfully but in post
>> man I'm getting :*
>>
>>
>>
>> *{"detail": "CSRF Failed: CSRF token missing or incorrect."}*
>>
>> *Do I need to use csrf_exempt inside APIView(post) request?*
>>
>> *If yes, then why it is working some times?*
>>
>> *Thank you in advance*
>>
>> *Regards,*
>> *Soumen*
>>
>>
>>
>>
>>
>> * -- 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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%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/CAPjsHcEfamWnYiQbK914Y0SV2whkOXFthb3ZvOjBv2aw1-GL6A%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/CAPUw6WZt0_TRLF-ZaFrqJvbcejuqaD_DVD4Z1%2B%3DpZhAwPzT1fA%40mail.gmail.com.


Re: Csrf_exempt

2020-01-09 Thread Suraj Thapa FC
Code...?

On Thu, 9 Jan 2020, 8:40 pm Soumen Khatua, 
wrote:

> Hi Folks,
>
> In django rest framework,I extend the LoginApiView(APIView) but when I'm
> passing username and password in browser it logn successfully but in post
> man I'm getting :
>
>
> *{"detail": "CSRF Failed: CSRF token missing or incorrect."}*
>
> Do I need to use csrf_exempt inside APIView(post) request?
>
> If yes, then why it is working some times?
>
> Thank you in advance
>
> Regards,
> Soumen
>
> --
> 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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%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/CAPjsHcEfamWnYiQbK914Y0SV2whkOXFthb3ZvOjBv2aw1-GL6A%40mail.gmail.com.


Csrf_exempt

2020-01-09 Thread Soumen Khatua
Hi Folks,

In django rest framework,I extend the LoginApiView(APIView) but when I'm
passing username and password in browser it logn successfully but in post
man I'm getting :


*{"detail": "CSRF Failed: CSRF token missing or incorrect."}*

Do I need to use csrf_exempt inside APIView(post) request?

If yes, then why it is working some times?

Thank you in advance

Regards,
Soumen

-- 
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/CAPUw6WZC3C9WVFwGskF8uYs3pqM0fQLe9MKsqgr4FvNzxzELmw%40mail.gmail.com.


Re: Django Makemigration Error Can't Serialize

2020-01-09 Thread Caique Reinhold
The problem is on the on_delete=models.SET() lines.

The models.SET() option does not accept field declarations. It should be 
given a method or a queryset that must return an instance of the 
relationship model.

You can read more about how to use SET in the documentation: 
https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.SET
 


On Thursday, January 9, 2020 at 9:57:08 AM UTC-3, Wesley Montcho wrote:
>
> Hello everyone, 
> I'm a beginner in coding and i choose python,  like my favorite. 
>
>
> I am interresting myself to python frameworks, and technologies, and I'm 
> trying to have knoweldge in web develoment through django; 
>
> But, recently i have some error of migration in my django project that i 
> cannot fix; 
>
> When i try to make migrations i have this error:
>
> ValueError: Cannot serialize: 
>  0x01885B094160>
> There are some values Django cannot serialize into migration files.
> For more, see 
> https://docs.djangoproject.com/en/2.2/topics/migrations/#migration-serializing
>
>
>
> please i want some person to help me about this, i have somme challenge 
> and this error make me late; 
>
> Thanks
>

-- 
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/c76cdcf4-a507-4b84-b3d5-2e89f544ba61%40googlegroups.com.


Calculated fields and ordering

2020-01-09 Thread Manos Zeakis
 

I have created a calculated field in models.py

 

<…>

@property

def final_score(self):

return (100.0 * self.a) /(1 + 0.1 * self.b)

<…>

 

 

And declare it in admin.py 

 

<…>

@admin.register(Project)

class TaskAdmin(admin.ModelAdmin):

fields = (<...>, 'final_score')

list_display = fields

<…>

 

Final_score field appears successfully in admin listview, but instead of 
“normal” fields it does not have an ordering option.

 

I searched for it and I found that calculated fields cannot be sorted 
because they do not actually exist in database (which is valid, but I am 
not sure that I can fully understand the connection between the two).

 

Moreover I cannot understand what is going on with the get_query workaround 
that is used in order to provide ordering for this field. By not 
understanding, I cannot adapt it to my implementation.

 

Could someone please give me an insight on why there are these difficulties 
and workarounds with calculated fields and ordering? Thank you

-- 
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/851b346d-b110-483c-8be6-d8f71958dea8%40googlegroups.com.


Re: Django Validation error

2020-01-09 Thread Wesley Montcho
Hello
Thanks for helping me
I want to ask you something else, Should I create serializer.py  or it is
some file I can modify

Le jeu. 9 janv. 2020 à 13:59, Suraj Thapa FC  a
écrit :

> Use try catch and send  whatever response you want to send
>
> On Wed, 8 Jan 2020, 10:36 pm Soumen Khatua, 
> wrote:
>
>>
>> *seriazlizers.py*
>>
>>
>>
>>
>>
>>
>> *email =
>> serializers.EmailField(required=True,validators=[UniqueValidator(queryset=User.objects.all())])
>>   phone_number = serializers.CharField(required =
>> True,validators=[UniqueValidator(queryset=User.objects.all())])password
>> = serializers.CharField(write_only=True,required=True,
>>   help_text='Leave empty if no change needed',
>>   style={'input_type': 'password', 'placeholder':
>> 'Password'}*
>> *) *
>>
>> *models.py*
>>
>>
>>
>>
>>
>>
>>
>>
>> * email = models.EmailField(_('email address'), unique=True)
>> phone_number = models.CharField(max_length=10,unique = True,
>> blank=False,default = uuid.uuid4().hex[:8])
>> first_name = models.CharField(_('first name'), max_length=30)last_name
>> = models.CharField(_('last name'), max_length=30, blank=True)is_active
>> = models.BooleanField(_('active'), default=True)is_staff =
>> models.BooleanField(_('staff status'),default=False)date_joined =
>> models.DateTimeField(_('date joined'), default=timezone.now)*
>>
>>
>>   I already did that but I want to raise validation error that email
>> should be unique and password should be alphanumeric character in json
>> format?
>>
>> On Wed, Jan 8, 2020 at 9:44 PM Suraj Thapa FC 
>> wrote:
>>
>>> For email you can set email field in model as unique=True and the
>>> password should be  stored in hash..
>>>
>>> On Wed, 8 Jan 2020, 9:37 pm Soumen Khatua, 
>>> wrote:
>>>
 Hi Folk,

 What is the process to validate fields in django rest framework?
 like email and phone number should be unique and password should be
 alphanumeric character only.

 Where i need to write the logic inside serializers or views part and
 how i can do that?

 Thank you in advance

 Regards,
 Soumen


 --
 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/CAPUw6Wb7_45-r165wg10M-w%2B6V6zOheCnEC3_chbJ-GEHRGQLA%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/CAPjsHcFKnaczwY-%3DKWqbPWrUuecv6YYWR19qPwSWmZpSYG%2BW0w%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/CAPUw6WbDFeAtOxksdOijTOidX%3DW8gzCs38fN_nXMSK%3DLFxA1cg%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/CAPjsHcHcs2ogHe6bHJt44_0saVPsR1fgug0RrQ%3D%3DEQYJRJzwHQ%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/CAGRNXvQ4mbVee3z6e4KWVfjqYojsBL24cg3Dqx%2BHRSRZsJOaBA%40mail.gmail.com.


Re: Dajgo Validation error

2020-01-09 Thread Suraj Thapa FC
Use try catch and send  whatever response you want to send

On Wed, 8 Jan 2020, 10:36 pm Soumen Khatua, 
wrote:

>
> *seriazlizers.py*
>
>
>
>
>
>
> *email =
> serializers.EmailField(required=True,validators=[UniqueValidator(queryset=User.objects.all())])
>   phone_number = serializers.CharField(required =
> True,validators=[UniqueValidator(queryset=User.objects.all())])password
> = serializers.CharField(write_only=True,required=True,
>   help_text='Leave empty if no change needed',
>   style={'input_type': 'password', 'placeholder':
> 'Password'}*
> *) *
>
> *models.py*
>
>
>
>
>
>
>
>
> * email = models.EmailField(_('email address'), unique=True)
> phone_number = models.CharField(max_length=10,unique = True,
> blank=False,default = uuid.uuid4().hex[:8])
> first_name = models.CharField(_('first name'), max_length=30)last_name
> = models.CharField(_('last name'), max_length=30, blank=True)is_active
> = models.BooleanField(_('active'), default=True)is_staff =
> models.BooleanField(_('staff status'),default=False)date_joined =
> models.DateTimeField(_('date joined'), default=timezone.now)*
>
>
>   I already did that but I want to raise validation error that email
> should be unique and password should be alphanumeric character in json
> format?
>
> On Wed, Jan 8, 2020 at 9:44 PM Suraj Thapa FC 
> wrote:
>
>> For email you can set email field in model as unique=True and the
>> password should be  stored in hash..
>>
>> On Wed, 8 Jan 2020, 9:37 pm Soumen Khatua, 
>> wrote:
>>
>>> Hi Folk,
>>>
>>> What is the process to validate fields in django rest framework?
>>> like email and phone number should be unique and password should be
>>> alphanumeric character only.
>>>
>>> Where i need to write the logic inside serializers or views part and how
>>> i can do that?
>>>
>>> Thank you in advance
>>>
>>> Regards,
>>> Soumen
>>>
>>>
>>> --
>>> 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/CAPUw6Wb7_45-r165wg10M-w%2B6V6zOheCnEC3_chbJ-GEHRGQLA%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/CAPjsHcFKnaczwY-%3DKWqbPWrUuecv6YYWR19qPwSWmZpSYG%2BW0w%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/CAPUw6WbDFeAtOxksdOijTOidX%3DW8gzCs38fN_nXMSK%3DLFxA1cg%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/CAPjsHcHcs2ogHe6bHJt44_0saVPsR1fgug0RrQ%3D%3DEQYJRJzwHQ%40mail.gmail.com.


Django Makemigration Error Can't Serialize

2020-01-09 Thread Wesley Montcho
Hello everyone, 
I'm a beginner in coding and i choose python,  like my favorite. 


I am interresting myself to python frameworks, and technologies, and I'm 
trying to have knoweldge in web develoment through django; 

But, recently i have some error of migration in my django project that i 
cannot fix; 

When i try to make migrations i have this error:

ValueError: Cannot serialize: 

There are some values Django cannot serialize into migration files.
For more, see 
https://docs.djangoproject.com/en/2.2/topics/migrations/#migration-serializing



please i want some person to help me about this, i have somme challenge and 
this error make me late; 

Thanks

-- 
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/6753e5ad-a617-429e-b092-caad0924cd73%40googlegroups.com.
from django.db import models
from django.db.models.query_utils import DeferredAttribute


# Create your models here.
class Sexe(models.Model):
genre = models.CharField(max_length=10)
abreviation = models.CharField(max_length=1)

def __unicode__(self):
return self.abreviation


class Activite(models.Model):
nom_domaine = models.CharField(max_length=100)
description = models.TextField()

def __unicode__(self):
return self.nom_domaine


class Personne(models.Model):
# Informations basiques concernants l'utilisateur
nom = models.CharField(max_length=30)
prenom = models.CharField(max_length=30)
pseudo = models.CharField(max_length=10, null=True)
date_de_naissance = models.DateField()
sexe = models.OneToOneField(Sexe, on_delete=models.SET(Sexe.abreviation))

# Information supplementaires
telephone = models.CharField(max_length=20)
profession = models.CharField(max_length=30)
domaine_activite = models.ForeignKey(Activite, on_delete=models.SET(str(Activite.nom_domaine)))

# Informations de connection au compte
email = models.EmailField()
mot_de_passe = models.CharField(max_length=255)

# Details par rapport l'activté sur le compte de la personne
amis = models.ManyToManyField('self', null=True)

def __unicode__(self):
return str(self.nom) + " " + str(self.prenom)


class Message(models.Model):
destinateur = models.ForeignKey(Personne, related_name="sender",
on_delete=models.SET(str(Personne.nom)+"..."+str(Personne.prenom)), blank=True,
null=False)
destinataire = models.ForeignKey(Personne,
 on_delete=models.SET(str(Personne.nom)+"..."+str(Personne.prenom)), blank=False,
 null=False)
contenu = models.TextField()
date_envoi = models.DateField(auto_now=True)

def __unicode__(self):
if self.contenu > 20:
return str(self.destinateur) + "; " + str(self.contenu[:19]) + "..."
else:
return str(self.destinateur) + "; " + str(self.contenu)


class Publication(models.Model):
auteur = models.ForeignKey(Personne, on_delete=models.SET(str(Personne.nom)+"..."+str(Personne.prenom)))
contenu = models.TextField(null=False)
image_attache = models.ImageField(null=True)

def __unicode__(self):
if self.contenu > 20:
return str(self.destinateur) + "; " + str(self.contenu[:19]) + "..."
else:
return str(self.destinateur) + "; " + str(self.contenu)


class Profil(models.Model):
user = models.OneToOneField(Personne, on_delete=models.SET(str(Personne.nom)+"..."+str(Personne.prenom)))
photo_de_profil = models.ImageField()

def __unicode__(self):
return str(self.user.nom) + " " + str(self.user.prenom)


class ProfilImage(models.Model):
profil = models.OneToOneField(Profil, on_delete= models.CASCADE)
image = models.ImageField(upload_to='WesBox/images/')
featured = models.BooleanField(default=False)
thumbnail = models.BooleanField(default=False)
active = models.BooleanField(default=True)
updated = models.DateTimeField(auto_now_add=False, auto_now=True)


Re: Request for an internship

2020-01-09 Thread neha somani
Can u pl send me your detailed CV

On Thu, 9 Jan 2020, 9:48 am Bryan Maxx,  wrote:

> I'm looking for an internship in the field of ICT,IT,MEDICINE, and
> PHYSICS. Incase you can offer or know of one, kindly inform me. Thank you.
>
> --
> 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/CAKHMJxqsoiEBApTE9vi65SDifZpU_vw%2BAz7j1EjzCGovJp8zUw%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%2BjbrPBXBagS51%2BpConB1_ta7pfif659Stac%3Doec4f83pEG3pA%40mail.gmail.com.


Re: Training course and/or job

2020-01-09 Thread sagar podilapu
Hi Red,

Are you looking for a free course or a paid one?
There are plenty of free resources on youtube.
I like Corey Schafer tutorial on youtube.
On Udemy, you will find the courses but I did not see a difference between
them and youtube.
If you would like to have a mentor based learning where you can post your
questions and get answers when you are stuck, Airpair can help.

Even this community can help when there are roadblocks.


On Thu, Jan 9, 2020 at 2:19 PM red  wrote:

> Hello,
>
> I’m a 27 years old french guy and a Django beginner. I have a mechanical
> engineering and a computer science degree, but in web development
> specifically, I’m a self-learner. I really do love Django and would like
> to become a professional web backend developer, or possible full stack,
> since I also have some basics in HTML5 and CSS3. I’m also opened to
> remote work.
>
> Does somebody have some hints about where to complete my training in web
> development ? I’m also opened and available for job propositions. Thanks,
>
> Regards,
>
> Redmood
>
> --
> 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/69a705ca-6e35-6d9f-ccb7-e8bd3aaec8db%40riseup.net
> .
>

-- 
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/CABZR%2BaN%2Ba6cSJw6A0%2Bv3B%3DnHoy3pqrq8CAqNnpTaez-K7iE6cA%40mail.gmail.com.


Django integration with node js

2020-01-09 Thread Muhammed RAFI A
Django integration with node js for any reference

-- 
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/e97b41e8-4529-434d-a61c-043b164c66e1%40googlegroups.com.


Re: Make a Django query filter at runtime

2020-01-09 Thread Ezequias Rocha
Thank you very much Alex and Shaheed, but if I want to use the *>, >= <, <=* 
how do do that?

On Wednesday, January 8, 2020 at 10:08:18 PM UTC-3, Alex Conselvan de 
Oliveira wrote:
>
> Hi Ezequias,
>
> You could use a dict:
>
> data = {
>   'name': 'John',
>   'age': 42,
> }
>
> model.filter(**data)
>
> Best Regards!
>
> Em qua., 8 de jan. de 2020 às 18:09, Ezequias Rocha  > escreveu:
>
>> Hi everyone
>>
>> I am in a doubt about creating django filters dynamically.
>>
>> All you know a filter is made by using the parameters like:
>>
>> model.filter(name='John', age=42)
>>
>> But if I can't type all fields and values at design time but at runtime 
>> how to do that?
>>
>> Best regards
>> Ezequias
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/9c843d02-235f-411f-8e83-7fea2156893b%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/542776d8-e6d4-472d-b72d-782e2cb628d0%40googlegroups.com.


Re: DRF

2020-01-09 Thread Mandeep Tondak
Yes

On Thu, Jan 9, 2020, 2:55 PM Soumen Khatua 
wrote:

> if i'm using serializers still i need to do that?
>
>
> On Thu, Jan 9, 2020 at 2:39 PM Mandeep Tondak 
> wrote:
>
>> Hi,
>>
>> You need to import json then you can do like this
>>
>> import json
>> data_json = json.loads(request.body.decode('utf-8'))
>>
>> * decode('utf-8')  if you are using python 3
>>
>> Thanks
>>
>> On Thu, Jan 9, 2020 at 1:01 PM Soumen Khatua 
>> wrote:
>>
>>> Hi Folks,
>>>
>>> *If I'm sending data into json format like this:*
>>>
>>> *{ "name":"soumen","password":"@sou123"}*
>>>
>>> *but in my python class,If doing something like this:*
>>>
>>> *type(request.data.get("name")  #<'class Dict'> *
>>>
>>> *How it is possible without using serializer,How I can do access json
>>> data diresctly?*
>>>
>>> *I'm using Django rest Framework.*
>>>
>>>
>>> *Thank you in advance*
>>>
>>> *Regards,*
>>> *Soumen*
>>>
>>> --
>>> 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/CAPUw6WYN%2B73BMfnoLa_aq0t4090iGDAdBAtKhu5qXyfZPZiYsA%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Warm Regard:-
>> Mandeep Kumar
>>
>> --
>> 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/CAJri7ST%2Bk__NtTPC0pk%2BpwHm6s4Brr7JAPe1s_8qpM0R-kyVtA%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/CAPUw6WaDWFa6Cims-Ecf8MZrmJXsuWA7M8ekFWpUN%3DmdtbkA1w%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/CAJri7SRV8sr%2B4fvU4wwYTFw3cBdtDYbeGZ3B8%2BfBYPzoDkt3JQ%40mail.gmail.com.


Re: Training course and/or job

2020-01-09 Thread Debora Peralta
Hi red,

I might help if you are willing to pay a course.

Contact me for more details.

Kind regards,

Debora.

El El jue, 9 ene 2020 a las 8:49, red  escribió:

> Hello,
>
> I’m a 27 years old french guy and a Django beginner. I have a mechanical
> engineering and a computer science degree, but in web development
> specifically, I’m a self-learner. I really do love Django and would like
> to become a professional web backend developer, or possible full stack,
> since I also have some basics in HTML5 and CSS3. I’m also opened to
> remote work.
>
> Does somebody have some hints about where to complete my training in web
> development ? I’m also opened and available for job propositions. Thanks,
>
> Regards,
>
> Redmood
>
> --
> 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/69a705ca-6e35-6d9f-ccb7-e8bd3aaec8db%40riseup.net
> .
>

-- 
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/CAAhU9n4dUmVCSmtuOXgX%2B4NMOXe_S5qBP4FNES73Byhmr-w6CQ%40mail.gmail.com.


Re: DRF

2020-01-09 Thread Soumen Khatua
if i'm using serializers still i need to do that?


On Thu, Jan 9, 2020 at 2:39 PM Mandeep Tondak  wrote:

> Hi,
>
> You need to import json then you can do like this
>
> import json
> data_json = json.loads(request.body.decode('utf-8'))
>
> * decode('utf-8')  if you are using python 3
>
> Thanks
>
> On Thu, Jan 9, 2020 at 1:01 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> *If I'm sending data into json format like this:*
>>
>> *{ "name":"soumen","password":"@sou123"}*
>>
>> *but in my python class,If doing something like this:*
>>
>> *type(request.data.get("name")  #<'class Dict'> *
>>
>> *How it is possible without using serializer,How I can do access json
>> data diresctly?*
>>
>> *I'm using Django rest Framework.*
>>
>>
>> *Thank you in advance*
>>
>> *Regards,*
>> *Soumen*
>>
>> --
>> 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/CAPUw6WYN%2B73BMfnoLa_aq0t4090iGDAdBAtKhu5qXyfZPZiYsA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Warm Regard:-
> Mandeep Kumar
>
> --
> 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/CAJri7ST%2Bk__NtTPC0pk%2BpwHm6s4Brr7JAPe1s_8qpM0R-kyVtA%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/CAPUw6WaDWFa6Cims-Ecf8MZrmJXsuWA7M8ekFWpUN%3DmdtbkA1w%40mail.gmail.com.


Re: DRF

2020-01-09 Thread Mandeep Tondak
Hi,

You need to import json then you can do like this

import json
data_json = json.loads(request.body.decode('utf-8'))

* decode('utf-8')  if you are using python 3

Thanks

On Thu, Jan 9, 2020 at 1:01 PM Soumen Khatua 
wrote:

> Hi Folks,
>
> *If I'm sending data into json format like this:*
>
> *{ "name":"soumen","password":"@sou123"}*
>
> *but in my python class,If doing something like this:*
>
> *type(request.data.get("name")  #<'class Dict'> *
>
> *How it is possible without using serializer,How I can do access json data
> diresctly?*
>
> *I'm using Django rest Framework.*
>
>
> *Thank you in advance*
>
> *Regards,*
> *Soumen*
>
> --
> 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/CAPUw6WYN%2B73BMfnoLa_aq0t4090iGDAdBAtKhu5qXyfZPZiYsA%40mail.gmail.com
> 
> .
>


-- 
Warm Regard:-
Mandeep Kumar

-- 
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/CAJri7ST%2Bk__NtTPC0pk%2BpwHm6s4Brr7JAPe1s_8qpM0R-kyVtA%40mail.gmail.com.


Training course and/or job

2020-01-09 Thread red
Hello,

I’m a 27 years old french guy and a Django beginner. I have a mechanical
engineering and a computer science degree, but in web development
specifically, I’m a self-learner. I really do love Django and would like
to become a professional web backend developer, or possible full stack,
since I also have some basics in HTML5 and CSS3. I’m also opened to
remote work.

Does somebody have some hints about where to complete my training in web
development ? I’m also opened and available for job propositions. Thanks,

Regards,

Redmood

-- 
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/69a705ca-6e35-6d9f-ccb7-e8bd3aaec8db%40riseup.net.