thaRe: hi,

2022-11-02 Thread Adekola Aderonmu
Thank you so much
I've gotten it now. Thanks guys.


On Tuesday, 1 November 2022 at 07:18:44 UTC+1 ahmadabd...@gmail.com wrote:

> Check under your root project URLs (gfg/urls.py) you have not import 
> include.
>
> On Tue, Nov 1, 2022, 1:22 AM Hansel Johansyah  
> wrote:
>
>> give , (comma) after path, wich include, like this
>> from django.urls import path, include
>>
>> On Tue, Nov 1, 2022 at 7:12 AM Adekola Aderonmu  
>> wrote:
>>
>>> Hi, i am new to django frame work. my runserver is giving me errors.[image: 
>>> SS1.png][image: SS2.png][image: SS3.png][image: SS5.png] kindly, help 
>>> me with what to do. Thanks. Find below are screen shot from my codes and 
>>> also from my browser. Look forward to hearing from you soon. 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/8942bcee-9f9c-47d8-9cb3-f666e6bb17a3n%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CADMJuBmDzY%3DifX_jNjOY%2BTWzWGsJVHm%2BOEhvJ389XPMfQBMnBA%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/5d051949-e9a9-4db2-9ecc-4f87012d3e45n%40googlegroups.com.


Re: Template inheritance not working

2022-11-02 Thread FLAVIEN HERI
can it be the problem of the first block content which is empty.in
index.html, try to delete the empty block content, leave the second
one and see what happen

On 10/31/22, Ammar Mohammed  wrote:
> Hello dear
> There is a little mistake in your code :
> You should put the {%block block_name %} in your base template with no code
> and the put the code you want to be displayed in your child template file
> Here is an example :
>
> // file.html :
>
> {% extends "index.html" %}
>
> {% block content %}
> Hello, this is a test.
> Help me.
> {% endblock %}
>
> //index.html:
> 
> 
> 
> 
> 
> Document
> 
> 
> {% block content %}
>
> {% endblock %}
> 
> 
>
>
> --
> 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/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
> 
> .
>
>
> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com> wrote:
>
>> I have been trying to get my templates to work but they have been
>> ineffective. here is my code:
>> {% extends "index.html" %}
>>
>> 
>> 
>> 
>> 
>> 
>> Document
>> 
>> 
>> 
>> {% block content %}
>>
>>
>> {% endblock %}
>> 
>> 
>> 
>>
>> //index.html:
>>
>> 
>> 
>> 
>> 
>> 
>> Document
>> 
>> 
>> {% block content %}
>> Hello, this is a test.
>> Help me.
>> {% endblock %}
>> 
>> 
>>
>> --
>> 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/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%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/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com.
>


-- 
FLAVIEN HERI

*Information management AscociateUNHCR-Kinshasa*
Tél:+243978587009
Skype: flavien.heri1
Facebook: flavien semi

-- 
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/CAG3GEnzUyDRz-a2BmmuV%3DgatN-3UY7SmxO36yryaZFybVqc7Tg%40mail.gmail.com.


Re: Template inheritance not working

2022-11-02 Thread peteru mimo
Your template inheritance cannot be index.html make it base.html and put
whatever you want to be display in all pages on it then extends it in index
page and other page

On Wed, Nov 2, 2022 at 10:26 AM FLAVIEN HERI  wrote:

> can it be the problem of the first block content which is empty.in
> index.html, try to delete the empty block content, leave the second
> one and see what happen
>
> On 10/31/22, Ammar Mohammed  wrote:
> > Hello dear
> > There is a little mistake in your code :
> > You should put the {%block block_name %} in your base template with no
> code
> > and the put the code you want to be displayed in your child template file
> > Here is an example :
> >
> > // file.html :
> >
> > {% extends "index.html" %}
> >
> > {% block content %}
> > Hello, this is a test.
> > Help me.
> > {% endblock %}
> >
> > //index.html:
> > 
> > 
> > 
> > 
> > 
> > Document
> > 
> > 
> > {% block content %}
> >
> > {% endblock %}
> > 
> > 
> >
> >
> > --
> > 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/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer
> >
> > .
> >
> >
> > On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
> wrote:
> >
> >> I have been trying to get my templates to work but they have been
> >> ineffective. here is my code:
> >> {% extends "index.html" %}
> >>
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Document
> >> 
> >> 
> >> 
> >> {% block content %}
> >>
> >>
> >> {% endblock %}
> >> 
> >> 
> >> 
> >>
> >> //index.html:
> >>
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Document
> >> 
> >> 
> >> {% block content %}
> >> Hello, this is a test.
> >> Help me.
> >> {% endblock %}
> >> 
> >> 
> >>
> >> --
> >> 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/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
> >> <
> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer
> >
> >> .
> >>
> >
> > --
> > 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/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com
> .
> >
>
>
> --
> FLAVIEN HERI
>
> *Information management AscociateUNHCR-Kinshasa*
> Tél:+243978587009
> Skype: flavien.heri1
> Facebook: flavien semi
>
> --
> 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/CAG3GEnzUyDRz-a2BmmuV%3DgatN-3UY7SmxO36yryaZFybVqc7Tg%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/CAJBAA1KVYP16RYzo1sQmbAkSnSgvwiYSj_%3Dn3oZiywQYJWU5eg%40mail.gmail.com.


Re: my project doesnt insert into the database

2022-11-02 Thread 'Kasper Laudrup' via Django users

On 01/11/2022 14.09, Mh Raffi wrote:

Hi Sorry Looking for thread to my problem. Landed here.


That is not how a mailing list or forum works. You don't find an 
existing thread and use it for a completely unrelated issue.


You simply post a new message/mail with your issue instead. Maybe 
reading this would be a good start:


https://support.google.com/groups/

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/ea36ed7e-094f-c102-9793-64fe87ccc4e2%40stacktrace.dk.


how to solve error in swagger api documentation

2022-11-02 Thread Motasem Al_Mobayyed
swagger API documentation cannot appear, only an error appears because 
generic field from content type interface
how to solve it   

-- 
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/dcce91d4-a747-4670-9378-7129cf93fef9n%40googlegroups.com.


got error in terminal, ubuntu

2022-11-02 Thread AKHIL KORE
(myprojectenv) user@DIPL-PC290:~/myprojectdir$ django-admin.py startproject
myproject ~/myprojectdir
django-admin.py: command not found

-- 
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/CAB11hN_4ZsBELy%2B%3D8AyuZTT-FXizppJZ22fjY5r1pGgP%3DT4gGw%40mail.gmail.com.


How to use choices in model field

2022-11-02 Thread Aaryan R Soni
Hey guys, i am facing some issues using choices in models.CharField. I am 
creating a model which has username and status, where status is my choice 
field. it has 2 values, 'Unverified' and 'Verified'.

class user_stutus(models.Model):
status_choices=[('Unverified','Unverified'),('Verified','Verified')]
uname=models.OneToOneField(User,on_delete=models.CASCADE)
status=models.CharField(max_length=11,choices=status_choices,default=
'Unverified')

def verifyCode(request):
global errors,session
if request.method == 'POST':
code = request.POST['code']
user=User.objects.get(email=session['email'])
print('user',user)
print('request',session['email'])
if session['code'] != code:
errors['code'] = 'Verification code did not match!'
return redirect('/user/user-verify/')
verification = user_stutus.objects.get(username=user)

*verification.status = 'Verified'#here i am changing its value and 
facing the issue.*
return redirect('/user/user-login/')

can someone give me any solution for this?
Thank you!

-- 


 

*DISCLAIMER*

Any
 views or opinions presented in this email are 
solely those of the 
author and do not necessarily represent those of the 
Ganpat University.

 

-- 


 

*DISCLAIMER*

Any
 views or opinions presented in this email are 
solely those of the 
author and do not necessarily represent those of the 
Ganpat University.

 

-- 
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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%40googlegroups.com.


Loop through QuerySet in Django

2022-11-02 Thread Marcelo A. Robin
I have a processors.py file where I generate a context processor to load 
static data into my project's base template. I have posts and I want to 
generate as a kind of archive in a aside, where you can access through a 
link, the posts that were created in the month of August 2022 (for example) 
and that will take me to a page where I will see the entire list of posts. 
To build that list, from this kind of file, I do the following in the 
processors.py file:

def ctx_dic_history(request): 
ctx_history = {} ctx_history['dates'] = 
Post.objects.dates('created','month').distinct()
return ctx_history

If I put {{ dates }} in the aside, it returns the following:



Now I want to go through that queryset, but I can't get what I need: I want 
them to be sorted descending first, that is, the most recent month on top. 
Second, I want to access the month and the year, that is, something like 
"August 2022" appears.

{% for item in dates %} Probando {% endfor %}

With that I can iterate over the items that this queryset brings me, but I 
don't know how to access the date in question for each item in the 
queryset. If you can give me a hand I would appreciate it in advance. If I 
manage to get it to work, I'll definitely post the answer that worked for 
me. Thank you so much

-- 
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/96f58712-88e9-4eae-94f6-909918f2045en%40googlegroups.com.


Re: How to use choices in model field

2022-11-02 Thread kateregga julius
Don't use square blackest [ ]

status_choices=(('Unverified','Unverified'),('Verified','Verified'))

On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni  wrote:

> Hey guys, i am facing some issues using choices in models.CharField. I am
> creating a model which has username and status, where status is my choice
> field. it has 2 values, 'Unverified' and 'Verified'.
>
> class user_stutus(models.Model):
> status_choices=[('Unverified','Unverified'),('Verified','Verified')]
> uname=models.OneToOneField(User,on_delete=models.CASCADE)
> status=models.CharField(max_length=11,choices=status_choices,default=
> 'Unverified')
>
> def verifyCode(request):
> global errors,session
> if request.method == 'POST':
> code = request.POST['code']
> user=User.objects.get(email=session['email'])
> print('user',user)
> print('request',session['email'])
> if session['code'] != code:
> errors['code'] = 'Verification code did not match!'
> return redirect('/user/user-verify/')
> verification = user_stutus.objects.get(username=user)
>
> *verification.status = 'Verified'#here i am changing its value and
> facing the issue.*
> return redirect('/user/user-login/')
>
> can someone give me any solution for this?
> Thank you!
>
>
>
> *DISCLAIMER*
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the Ganpat University.
>
>
>
>
>
> *DISCLAIMER*
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the Ganpat University.
>
>
>
> --
> 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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%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/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com.


Re: How to use choices in model field

2022-11-02 Thread Aaryan R Soni
Okay, but still the problem is that how do I set the value of status field,
as I have written in the code, verification.status = 'Verified' it is not
giving any error but it is not working either

On Wed, Nov 2, 2022, 9:51 PM kateregga julius 
wrote:

> Don't use square blackest [ ]
>
> status_choices=(('Unverified','Unverified'),('Verified','Verified'))
>
> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni 
> wrote:
>
>> Hey guys, i am facing some issues using choices in models.CharField. I am
>> creating a model which has username and status, where status is my choice
>> field. it has 2 values, 'Unverified' and 'Verified'.
>>
>> class user_stutus(models.Model):
>> status_choices=[('Unverified','Unverified'),('Verified','Verified')]
>> uname=models.OneToOneField(User,on_delete=models.CASCADE)
>> status=models.CharField(max_length=11,choices=status_choices,default=
>> 'Unverified')
>>
>> def verifyCode(request):
>> global errors,session
>> if request.method == 'POST':
>> code = request.POST['code']
>> user=User.objects.get(email=session['email'])
>> print('user',user)
>> print('request',session['email'])
>> if session['code'] != code:
>> errors['code'] = 'Verification code did not match!'
>> return redirect('/user/user-verify/')
>> verification = user_stutus.objects.get(username=user)
>>
>> *verification.status = 'Verified'#here i am changing its value and
>> facing the issue.*
>> return redirect('/user/user-login/')
>>
>> can someone give me any solution for this?
>> Thank you!
>>
>>
>>
>> *DISCLAIMER*
>>
>> Any views or opinions presented in this email are solely those of the
>> author and do not necessarily represent those of the Ganpat University.
>>
>>
>>
>>
>>
>> *DISCLAIMER*
>>
>> Any views or opinions presented in this email are solely those of the
>> author and do not necessarily represent those of the Ganpat University.
>>
>>
>>
>> --
>> 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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%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/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com
> 
> .
>

-- 


 

*DISCLAIMER*

Any
 views or opinions presented in this email are 
solely those of the 
author and do not necessarily represent those of the 
Ganpat University.

 

-- 


 

*DISCLAIMER*

Any
 views or opinions presented in this email are 
solely those of the 
author and do not necessarily represent those of the 
Ganpat University.

 

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


Recommend forum

2022-11-02 Thread kateregga julius
Here fellas
I need recommendations for these platform
1. Laravel
2. AI, ML and Big data
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/CAMVv_-EK%2BebghJiyo5E0cjif4KF0wOfPwwpO5HLinUYeeYQEmw%40mail.gmail.com.


Re: How to use choices in model field

2022-11-02 Thread Julio Cojom
When you change the status to Verified, you are only changing the object
instance in memory, to save it to the database, you need to call the method
save.

verification.save() at the end should make it work

El El mié, 2 de nov. de 2022 a la(s) 10:23, Aaryan R Soni <
aaryanrson...@gnu.ac.in> escribió:

> Okay, but still the problem is that how do I set the value of status
> field, as I have written in the code, verification.status = 'Verified' it
> is not giving any error but it is not working either
>
> On Wed, Nov 2, 2022, 9:51 PM kateregga julius 
> wrote:
>
>> Don't use square blackest [ ]
>>
>> status_choices=(('Unverified','Unverified'),('Verified','Verified'))
>>
>> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni 
>> wrote:
>>
>>> Hey guys, i am facing some issues using choices in models.CharField. I
>>> am creating a model which has username and status, where status is my
>>> choice field. it has 2 values, 'Unverified' and 'Verified'.
>>>
>>> class user_stutus(models.Model):
>>> status_choices=[('Unverified','Unverified'),('Verified','Verified')]
>>> uname=models.OneToOneField(User,on_delete=models.CASCADE)
>>> status=models.CharField(max_length=11,choices=status_choices,default
>>> ='Unverified')
>>>
>>> def verifyCode(request):
>>> global errors,session
>>> if request.method == 'POST':
>>> code = request.POST['code']
>>> user=User.objects.get(email=session['email'])
>>> print('user',user)
>>> print('request',session['email'])
>>> if session['code'] != code:
>>> errors['code'] = 'Verification code did not match!'
>>> return redirect('/user/user-verify/')
>>> verification = user_stutus.objects.get(username=user)
>>>
>>> *verification.status = 'Verified'#here i am changing its value and
>>> facing the issue.*
>>> return redirect('/user/user-login/')
>>>
>>> can someone give me any solution for this?
>>> Thank you!
>>>
>>>
>>>
>>> *DISCLAIMER*
>>>
>>> Any views or opinions presented in this email are solely those of the
>>> author and do not necessarily represent those of the Ganpat University.
>>>
>>>
>>>
>>>
>>>
>>> *DISCLAIMER*
>>>
>>> Any views or opinions presented in this email are solely those of the
>>> author and do not necessarily represent those of the Ganpat University.
>>>
>>>
>>>
>>> --
>>> 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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%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/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com
>> 
>> .
>>
>
>
>
> *DISCLAIMER*
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the Ganpat University.
>
>
>
>
>
> *DISCLAIMER*
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the Ganpat University.
>
>
>
> --
> 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/CAK5JjLSs9yNckAOEw0ygcXMFTkZRTZmZwAp_tPVA2n81kPzY6Q%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/CAHRQUH%3Dsb9jK0WgPf2FOUR9KebUUrsrcagG7%3DkhqPMJ_Kk0x4w%40mail.gmail.com.


Re: How to use choices in model field

2022-11-02 Thread kateregga julius
Apply a CRUD for updating the status
Wait I will send you the updated code in 30 minutes

On Wed, Nov 2, 2022, 7:23 PM Aaryan R Soni  wrote:

> Okay, but still the problem is that how do I set the value of status
> field, as I have written in the code, verification.status = 'Verified' it
> is not giving any error but it is not working either
>
> On Wed, Nov 2, 2022, 9:51 PM kateregga julius 
> wrote:
>
>> Don't use square blackest [ ]
>>
>> status_choices=(('Unverified','Unverified'),('Verified','Verified'))
>>
>> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni 
>> wrote:
>>
>>> Hey guys, i am facing some issues using choices in models.CharField. I
>>> am creating a model which has username and status, where status is my
>>> choice field. it has 2 values, 'Unverified' and 'Verified'.
>>>
>>> class user_stutus(models.Model):
>>> status_choices=[('Unverified','Unverified'),('Verified','Verified')]
>>> uname=models.OneToOneField(User,on_delete=models.CASCADE)
>>> status=models.CharField(max_length=11,choices=status_choices,default
>>> ='Unverified')
>>>
>>> def verifyCode(request):
>>> global errors,session
>>> if request.method == 'POST':
>>> code = request.POST['code']
>>> user=User.objects.get(email=session['email'])
>>> print('user',user)
>>> print('request',session['email'])
>>> if session['code'] != code:
>>> errors['code'] = 'Verification code did not match!'
>>> return redirect('/user/user-verify/')
>>> verification = user_stutus.objects.get(username=user)
>>>
>>> *verification.status = 'Verified'#here i am changing its value and
>>> facing the issue.*
>>> return redirect('/user/user-login/')
>>>
>>> can someone give me any solution for this?
>>> Thank you!
>>>
>>>
>>>
>>> *DISCLAIMER*
>>>
>>> Any views or opinions presented in this email are solely those of the
>>> author and do not necessarily represent those of the Ganpat University.
>>>
>>>
>>>
>>>
>>>
>>> *DISCLAIMER*
>>>
>>> Any views or opinions presented in this email are solely those of the
>>> author and do not necessarily represent those of the Ganpat University.
>>>
>>>
>>>
>>> --
>>> 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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%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/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com
>> 
>> .
>>
>
>
>
> *DISCLAIMER*
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the Ganpat University.
>
>
>
>
>
> *DISCLAIMER*
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the Ganpat University.
>
>
>
> --
> 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/CAK5JjLSs9yNckAOEw0ygcXMFTkZRTZmZwAp_tPVA2n81kPzY6Q%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/CAMVv_-EaSDUpAMW818%3Dqrdsr0yWcyXeLdbnFzEzyvd59%3DMBcSA%40mail.gmail.com.


Re: How to use choices in model field

2022-11-02 Thread Lloyd Leckenby
Class user_stutus?

> On Nov 2, 2022, at 9:22 AM, Aaryan R Soni  wrote:
> 
> Okay, but still the problem is that how do I set the value of status field, 
> as I have written in the code, verification.status = 'Verified' it is not 
> giving any error but it is not working either
> 
> On Wed, Nov 2, 2022, 9:51 PM kateregga julius  > wrote:
> Don't use square blackest [ ]
> 
> status_choices=(('Unverified','Unverified'),('Verified','Verified'))
> 
> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni  > wrote:
> Hey guys, i am facing some issues using choices in models.CharField. I am 
> creating a model which has username and status, where status is my choice 
> field. it has 2 values, 'Unverified' and 'Verified'.
> 
> class user_stutus(models.Model):
> status_choices=[('Unverified','Unverified'),('Verified','Verified')]
> uname=models.OneToOneField(User,on_delete=models.CASCADE)
> 
> status=models.CharField(max_length=11,choices=status_choices,default='Unverified')
> 
> def verifyCode(request):
> global errors,session
> if request.method == 'POST':
> code = request.POST['code']
> user=User.objects.get(email=session['email'])
> print('user',user)
> print('request',session['email'])
> if session['code'] != code:
> errors['code'] = 'Verification code did not match!'
> return redirect('/user/user-verify/')
> verification = user_stutus.objects.get(username=user)
> verification.status = 'Verified'#here i am changing its value and 
> facing the issue.
> return redirect('/user/user-login/')
> 
> can someone give me any solution for this?
> Thank you!
> 
>  
> DISCLAIMER
> Any views or opinions presented in this email are solely those of the author 
> and do not necessarily represent those of the Ganpat University.
>  
> 
>  
> DISCLAIMER
> Any views or opinions presented in this email are solely those of the author 
> and do not necessarily represent those of the Ganpat University.
>  
> 
> -- 
> 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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%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/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com
>  
> .
> 
>  
> DISCLAIMER
> Any views or opinions presented in this email are solely those of the author 
> and do not necessarily represent those of the Ganpat University.
>  
> 
>  
> DISCLAIMER
> Any views or opinions presented in this email are solely those of the author 
> and do not necessarily represent those of the Ganpat University.
>  
> 
> -- 
> 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/CAK5JjLSs9yNckAOEw0ygcXMFTkZRTZmZwAp_tPVA2n81kPzY6Q%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/907FFBEA-8FBE-4B2D-947A-39D8FE828777%40gmail.com.


New to Django

2022-11-02 Thread Kevin gallagher
Hi guys,
Im currently learning django and am doing a project for college. Im 
building an appointment website users can book a training session. These 
are my models:

class TimeSlot(models.Model):

title = models.CharField(max_length=50)

def __str__(self):
return f'There is a slot at {self.title}'


class Booking(models.Model):

user = models.ForeignKey(settings.AUTH_USER_MODEL,
 on_delete=models.CASCADE)
time_slot = models.ForeignKey(TimeSlot, on_delete=models.CASCADE)
booking_date = models.DateField(("Date"), default=date.today)

def __str__(self):
return f'{self.user} has booked a session at {self.timeslot.title} 
on {self.booking_date}'

I have the title field set as available session times, 1-2pm, 3-4pm etc.
I want the user to select a date and then be able to see what time slots 
are still available to book but I'm kind of lost and confused. Any help 
would be much appreciated! 
 

-- 
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/1c6c2ab1-f852-4503-81c5-d072cf2dbb02n%40googlegroups.com.


Re: got error in terminal, ubuntu

2022-11-02 Thread 'Kasper Laudrup' via Django users

On 02/11/2022 06.43, AKHIL KORE wrote:
(myprojectenv) user@DIPL-PC290:~/myprojectdir$ django-admin.py 
startproject myproject ~/myprojectdir

django-admin.py: command not found



For security reasons the current working directory is not in your PATH 
on Unix systems. You need to provide the full path to the executable you 
want to run, eg. ./django-admin.py.


Of course, the file needs to have the executable bit set as well.

Alternatively, ensure that django-admin.py is in your PATH environment 
as well as being executable of course.


You could also run the python source with the python interpreter instead 
of making it executable.


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/32dd97ae-119b-0fa6-be8c-c3830e7d03cc%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: How to use choices in model field

2022-11-02 Thread kateregga julius
Follow exactly what he has told you

On Wed, Nov 2, 2022, 7:27 PM Julio Cojom  wrote:

> When you change the status to Verified, you are only changing the object
> instance in memory, to save it to the database, you need to call the method
> save.
>
> verification.save() at the end should make it work
>
> El El mié, 2 de nov. de 2022 a la(s) 10:23, Aaryan R Soni <
> aaryanrson...@gnu.ac.in> escribió:
>
>> Okay, but still the problem is that how do I set the value of status
>> field, as I have written in the code, verification.status = 'Verified' it
>> is not giving any error but it is not working either
>>
>> On Wed, Nov 2, 2022, 9:51 PM kateregga julius 
>> wrote:
>>
>>> Don't use square blackest [ ]
>>>
>>> status_choices=(('Unverified','Unverified'),('Verified','Verified'))
>>>
>>> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni 
>>> wrote:
>>>
 Hey guys, i am facing some issues using choices in models.CharField. I
 am creating a model which has username and status, where status is my
 choice field. it has 2 values, 'Unverified' and 'Verified'.

 class user_stutus(models.Model):
 status_choices=[('Unverified','Unverified'),('Verified','Verified'
 )]
 uname=models.OneToOneField(User,on_delete=models.CASCADE)
 status=models.CharField(max_length=11,choices=status_choices
 ,default='Unverified')

 def verifyCode(request):
 global errors,session
 if request.method == 'POST':
 code = request.POST['code']
 user=User.objects.get(email=session['email'])
 print('user',user)
 print('request',session['email'])
 if session['code'] != code:
 errors['code'] = 'Verification code did not match!'
 return redirect('/user/user-verify/')
 verification = user_stutus.objects.get(username=user)

 *verification.status = 'Verified'#here i am changing its value and
 facing the issue.*
 return redirect('/user/user-login/')

 can someone give me any solution for this?
 Thank you!



 *DISCLAIMER*

 Any views or opinions presented in this email are solely those of the
 author and do not necessarily represent those of the Ganpat University.





 *DISCLAIMER*

 Any views or opinions presented in this email are solely those of the
 author and do not necessarily represent those of the Ganpat University.



 --
 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/6ee9dae8-2879-4c3d-a921-238b36fcb975n%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/CAMVv_-E9uO8A7tJH04mHpkS-LeCwdJVKnMXtppZKkqp6JM2K5Q%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>>
>> *DISCLAIMER*
>>
>> Any views or opinions presented in this email are solely those of the
>> author and do not necessarily represent those of the Ganpat University.
>>
>>
>>
>>
>>
>> *DISCLAIMER*
>>
>> Any views or opinions presented in this email are solely those of the
>> author and do not necessarily represent those of the Ganpat University.
>>
>>
>>
>> --
>> 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/CAK5JjLSs9yNckAOEw0ygcXMFTkZRTZmZwAp_tPVA2n81kPzY6Q%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/CAHRQUH%3Dsb9jK0WgPf2FOUR9KebUUrsrcagG7%3DkhqPMJ_Kk0x4w%40mail.gmail.com
> 

Re: New to Django

2022-11-02 Thread Sebastian Jung
Hello kevin,

There are several django booking apps like this
https://github.com/bernii/django-reservations

I think its easier to change existing code to your requirements then begin
from strech.

Good luck

Kevin gallagher  schrieb am Mi., 2. Nov. 2022,
18:04:

> Hi guys,
> Im currently learning django and am doing a project for college. Im
> building an appointment website users can book a training session. These
> are my models:
>
> class TimeSlot(models.Model):
>
> title = models.CharField(max_length=50)
>
> def __str__(self):
> return f'There is a slot at {self.title}'
>
>
> class Booking(models.Model):
>
> user = models.ForeignKey(settings.AUTH_USER_MODEL,
>  on_delete=models.CASCADE)
> time_slot = models.ForeignKey(TimeSlot, on_delete=models.CASCADE)
> booking_date = models.DateField(("Date"), default=date.today)
>
> def __str__(self):
> return f'{self.user} has booked a session at {self.timeslot.title}
> on {self.booking_date}'
>
> I have the title field set as available session times, 1-2pm, 3-4pm etc.
> I want the user to select a date and then be able to see what time slots
> are still available to book but I'm kind of lost and confused. Any help
> would be much appreciated!
>
>
> --
> 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/1c6c2ab1-f852-4503-81c5-d072cf2dbb02n%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/CAKGT9mys0yJGpE_TOW87ruPnvvxWzwh-Jo%2B3MrDSt_j9dmK4-A%40mail.gmail.com.


Re: I am unable to hash my password.

2022-11-02 Thread Saksham Khanal
Here you go
On Wednesday, 2 November 2022 at 9:12:54 pm UTC+5:45 hubak...@gmail.com 
wrote:

> Hi  Saksham, please let us see your user model.py and views.py.
>
> On Wed, Nov 2, 2022 at 2:52 PM Saksham Khanal  
> wrote:
>
>> when I try to new register new user form the API,the saved user doesn't 
>> have it's password hashed which is creating a problem while logging in.You 
>> can see the difference between admin and new_user.To create a user model I 
>> have inherited a Abstract user class.You can also check my register 
>> serializer
>> [image: Django_group.png][image: Django_group1.png] 
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d9adde23-46cd-40bf-babc-ced3d4b9d9ban%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/a358b0a3-b544-4cc5-98fa-394468b662e2n%40googlegroups.com.
#view.py
from urllib import request

from django.contrib.auth import login
from knox.auth import AuthToken
from knox.views import LoginView as KnoxLoginView
from rest_framework import permissions
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.decorators import api_view
from rest_framework.response import Response

from dsorders.api.serializers import RegisterSerializers


@api_view(['POST'])
def login_api(request):
	serializer=AuthTokenSerializer(data=request.data)
	serializer.is_valid(raise_exception=True)
	user = serializer.validated_data['user']
	_,token = AuthToken.objects.create(user)

	return Response({
	'user_info':{
		'id':user.id,
		'username':user.username,
		'email':user.email,
	},
	'token':token
	})

# class LoginView(KnoxLoginView):

# 	def post(self,request,format=None):
# 		serializer = AuthTokenSerializer(data=request.data)
# 		serializer.is_valid(raise_exception=True)
# 		user = serializer.validated_data['user']
# 		login(request,user)
# 		return super(LoginView,self).post(request,format=None)



@api_view(['POST'])
def register_api(request):
	serializer = RegisterSerializers(data=request.data)
	serializer.is_valid(raise_exception=True)

	user = serializer.save()
	_,token = AuthToken.objects.create(user)
	
	return Response({
	'user_info':{
		'id':user.id,
		'username':user.username,
		'email':user.email,
	},
	'token':token
	})



@api_view(['GET'])
def get_user_data(request):
user = request.user

if user.is_authenticated:
return Response({
'user_info':{
'id':user.id,
'username':user.username,
'email':user.email,
}
})
return Response({'error':'not is_authenticated'},status=400)

import email
from ast import Pass
from curses.ascii import NUL
from decimal import Decimal
from email.headerregistry import Address
from email.policy import default
from re import A
from tabnanny import verbose

from django.contrib.auth.models import AbstractUser, User
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver

# Create your models here.

class User(AbstractUser):
is_active: models.BooleanField(default=True)
is_staff: models.BooleanField(default=True)



class Dealer(models.Model):
name = models.CharField(max_length=100,verbose_name='Name',null=True,blank=True)
phone = models.CharField(max_length=15,verbose_name='Phone Number',unique=True)
persons_name = models.CharField(max_length=100,verbose_name="Person's name",null=True,blank=True)
additional_info = models.CharField(max_length=100,null=True,blank=True)
user = models.OneToOneField(User,null=True,blank=True,on_delete=models.SET_NULL,related_name="dealer_user")

def __str__(self):
return self.name
   
class Meta:
verbose_name_plural = 'Dealer'

class Salesman(models.Model):
name = models.CharField(max_length=100,verbose_name='Name',null=True,blank=True)
phone = models.CharField(max_length=12,verbose_name='Phone number',unique=True)
address = models.CharField(max_length=50,verbose_name='Address',null=True,blank=True)
additional_info = models.TextField(max_length=100,null=True,blank=True)
user = models.OneToOneField(User,null=True,blank=True,on_delete=models.SET_NULL,related_name='Salesman_user')
dealer = models.ForeignKey(Dealer,on_delete=models.SET_NULL,r