'ascii' codec can't encode character

2022-04-28 Thread Thiago Luiz Parolin
Hi,
i have a model with 2 charfields for givenname, surname:

   nome = models.CharField(
max_length=150,
verbose_name=_("Nome"),
default=''
)
sobrenome = models.CharField(
max_length=150,
verbose_name=_("Sobrenome"),
default=''
)

My modelForm does nothing, just defines a model at Meta with all fields.
My CreateView is just defined with all default values, not overriding
anything.
When submitting the form, the server returns 500 if 'nome' or 'sobrenome'
fields have accent letters like Á, é, í, ç. etc.

The error:
'ascii' codec can't encode character '\xe9' in position 4: ordinal not in
range(128)
with character depending on user input.

I am using sqlite for db and the pragma encoding returns utf8.

I don't know how to deal with it.
Any help would be 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/CANbmKyvUWshdM3ENz9LjbG66rLkt4vruM6cC9M-%3DKmL7rcCR%2Bg%40mail.gmail.com.


Re: Class based views with forms

2022-04-28 Thread Vishesh Mangla
Iommi forms

On Thu, 28 Apr 2022, 23:00 Ryan Nowakowski,  wrote:

> You're right, it's not very clear how to have a single class-based view
> handle both displaying details and submitting a form.  This is a
> fantastic site that shows how each class based view is set up
> inheritance-wise: https://ccbv.co.uk/
>
> Take a look the ancestors for DetailView:
>
> https://ccbv.co.uk/projects/Django/4.0/django.views.generic.detail/DetailView/
>
> ... and the ancestors for FormView:
> https://ccbv.co.uk/projects/Django/4.0/django.views.generic.edit/FormView/
>
>
> Maybe you can just add the FormMixin as an ancestor to your DetailView.
>
>
> As another option, maybe you can create a separate FormView that you can
> POST to from your DetailView.
>
>
> - Ryan N
>
> On 4/26/22 5:25 AM, alex smolyakov wrote:
> > Can anyone explain me how to make send email form on page.
> >
> > So my forms.py
> >
> > class ContactForm(forms.Form):
> > name = forms.CharField(required=True)
> > last_name = forms.CharField()
> > adults = forms.IntegerField() children = forms.IntegerField()
> > email = forms.EmailField(required=True)
> > message = forms.CharField(widget=forms.Textarea)
> >
> > views.py
> >
> > class TourDetailView(DetailView):
> > model = models.Tour
> > template_name = 'tours/tour-detail.html'
> > form_class = forms.ContactForm
> > success_url = 'tours.html'
> >
> > As far as i understand i need to get data from request , but i dont
> > know how to do it. There are a lot of information in function based
> > views, but i didnt get how to do it in class based views.
> >
> > And it would be nice of you to explain where should i put send_mail
> > function. Any help will be 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/235da153-a9d7-2582-ace4-3dbf147d17f8%40fattuba.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/CACaE8x55P%2BBLgpyoSfJtwmB%3DKp9YpQ-ndYyYTMb6BM8BboTv0Q%40mail.gmail.com.


Re: Class based views with forms

2022-04-28 Thread Ryan Nowakowski
You're right, it's not very clear how to have a single class-based view 
handle both displaying details and submitting a form.  This is a 
fantastic site that shows how each class based view is set up 
inheritance-wise: https://ccbv.co.uk/


Take a look the ancestors for DetailView: 
https://ccbv.co.uk/projects/Django/4.0/django.views.generic.detail/DetailView/


... and the ancestors for FormView: 
https://ccbv.co.uk/projects/Django/4.0/django.views.generic.edit/FormView/



Maybe you can just add the FormMixin as an ancestor to your DetailView.


As another option, maybe you can create a separate FormView that you can 
POST to from your DetailView.



- Ryan N

On 4/26/22 5:25 AM, alex smolyakov wrote:

Can anyone explain me how to make send email form on page.

So my forms.py

class ContactForm(forms.Form):
    name = forms.CharField(required=True)
    last_name = forms.CharField()
    adults = forms.IntegerField() children = forms.IntegerField()
    email = forms.EmailField(required=True)
    message = forms.CharField(widget=forms.Textarea)

views.py

class TourDetailView(DetailView):
    model = models.Tour
    template_name = 'tours/tour-detail.html'
    form_class = forms.ContactForm
    success_url = 'tours.html'

As far as i understand i need to get data from request , but i dont 
know how to do it. There are a lot of information in function based 
views, but i didnt get how to do it in class based views.


And it would be nice of you to explain where should i put send_mail 
function. Any help will be 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/235da153-a9d7-2582-ace4-3dbf147d17f8%40fattuba.com.


apply now - hurry up

2022-04-28 Thread Sakshi jain
Hey *[COLLEGE]* students!  It’s time to steer your career in the right
direction with Internshala Trainings and grab a prestigious summer training
certificate recognized by your college and *1,00,000+* companies. Choose
from a list of *70+* online courses like Digital Marketing, Web
Development, Programming with Python, and get career-ready in just 4-8
weeks!

*The best part?* You will get up to *Rs 350+55%* discount on all courses
through my link along with 1:1 doubt solving, free placement assistance,
and hands-on practice!  So hurry up, upskill yourself now -
https://internshala.com/i/TC-
ISP29SAKS7222.


Er.Sakshi jain

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


Re: SMTP Authentification error

2022-04-28 Thread Gift Soko
Hi, You need to enable the less secure apps on your google account. 
following this article 
: https://devanswers.co/allow-less-secure-apps-access-gmail-account/

On Wednesday, 27 April 2022 at 07:37:53 UTC+2 dcale...@ucdavis.edu wrote:

> Hello everyone, 
>
> May you please assist in informing me on what i need to do to resolve this 
> issue. 
>
> - *SMTPAuthenticationError at /password-reset/*
> *- (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 
> https://support.google.com/mail/?p=BadCredentials 
>  
> j64-20020a62c54300b0050d260c0ea8sm13366402pfg.110 - gsmtp')*
>
>
> I included the 16 character code to my environment variable and called it 
> in my settings.pymfile,  but still the error occurs. Also here is my 
> settings.py file:
>
> - *EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'*
> *EMAIL_HOST = 'smtp.gmail.com '*
> *EMAIL_PORT = 587*
> *EMAIL_USE_TLS = True*
> *EMAIL_HOST_USER = os.environ.get('DB_USER')*
> *EMAIL_HOST_PASSWORD = os.environ.get('DB_PASSWORD')*
>

-- 
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/fd9491c8-2ea5-4ddb-b8c2-f1f1c4496c3bn%40googlegroups.com.


Re: SMTP Authentification error

2022-04-28 Thread Antonis Christofides
In my experience, Gmail does not allow (or does not support) using it as a 
smarthost if all you have is a free account, and even if you get it to work it 
will eventually cause you headaches. I don't know if this has changed the last 
few years, but I feel it hasn't. It's much better to use another service. I use 
runbox.com; mailbox.org is another solution. These are both paid email services. 
In a recent thread, someone also mentioned mailgun and sendgrid, which may be 
better suited for this purpose.


Other than that, you should enter a breakpoint or something in your code to 
verify that the values of EMAIL_HOST_USER and EMAIL_HOST_PASSWORD are what they 
should.


Regards,

Antonis


On 28/04/2022 07.58, 'Delvin Alexander' via Django users wrote:

okay i did both but now i am getting this error. Any clue on why?

*SMTPSenderRefused at /password-reset/*
*
*
*(530, b'5.7.0 Authentication Required. Learn more at\n5.7.0 
https://support.google.com/mail/?p=WantAuthError 
w137-20020a62828f00b0050d2f9c3409sm14545822pfd.199 - gsmtp', 
'webmaster@localhost')

*
On Wednesday, April 27, 2022 at 12:27:02 AM UTC-7 dashlaksh...@gmail.com wrote:

Check whether you have turned on less secure apps or not.

On Wed, Apr 27, 2022, 11:07 'Delvin Alexander' via Django users
 wrote:

Hello everyone,

May you please assist in informing me on what i need to do to resolve
this issue.

- *SMTPAuthenticationError at /password-reset/*
*- (535, b'5.7.8 Username and Password not accepted. Learn more
at\n5.7.8 https://support.google.com/mail/?p=BadCredentials
j64-20020a62c54300b0050d260c0ea8sm13366402pfg.110 - gsmtp')*
*
*
*
*
I included the 16 character code to my environment variable and called
it in my settings.pymfile,  but still the error occurs. Also here is
my settings.py file:

- *EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'*
*EMAIL_HOST = 'smtp.gmail.com '*
*EMAIL_PORT = 587*
*EMAIL_USE_TLS = True*
*EMAIL_HOST_USER = os.environ.get('DB_USER')*
*EMAIL_HOST_PASSWORD = os.environ.get('DB_PASSWORD')*

-- 


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/c18935a8-43bf-4a15-a5ba-95209009498dn%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/a6f92133-32db-4f4a-ae46-bb1f7644b431n%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/c200b368-7cdb-19fe-cc69-9682d6548e81%40antonischristofides.com.