SMTP Authentification error

2022-04-26 Thread 'Delvin Alexander' via Django users
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/c18935a8-43bf-4a15-a5ba-95209009498dn%40googlegroups.com.


Django Rest Framework with self nested serializers

2022-04-26 Thread Sencer Hamarat
Hello people,

There are two models that are related to each other.

class Parent(models.Model):
name = models.CharField...

class Child(models.Model):
parent = models.ForeignKey(Parent)
value = models.CharField...

And there is a serializer built on "Child" model:

class ChildSerializer(serializers.ModelSerializer):
class Meta:
model = Child

What I need is getting all Child objects related with Parent object via
ChildSerializer

What should I do to achieve to the solution?

-- 
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/CACp8TZhC-tNYpVVAkRSGbS%2B9czU2U5oHvP5cR0ikiSAEGyWt1g%40mail.gmail.com.


RE: django.db.utils.InterfaceError: connection already closed

2022-04-26 Thread peter.wagemans via Django users

Michele,

  > ... the database connection seems to shut down randomly.

Could be the same problem as I described in

  Database "InterfaceError connection already closed" with asgi.

  https://groups.google.com/g/django-users/c/RmtFuCVLfPE/m/dBQjq7FsBQAJ

Django doesn't stick to the same thread (sync_to_async with
thread_sensitive=False) when generating a response for exceptions. I
haven't studied Django internals, but it seems that it might be better
to use thread_sensitive=True and try to keep using the database
connection prepared for the current request in the current thread.

Regards,

Peter Wagemans

-- 
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/AM9PR01MB7412C99DBA425D4B02E8D5319DFB9%40AM9PR01MB7412.eurprd01.prod.exchangelabs.com.


Help! I begginer...

2022-04-26 Thread Ricardo Pereira de Azevedo
Error:

  File 
"C:\Users\tecnico.ricardo\PycharmProjects\pythonProject01\venv01\lib\site-packages\django\db\models\sql\query.py",
 
line 11, in 
from collections import Counter, Iterator, Mapping, OrderedDict
ImportError: cannot import name 'Iterator' from 'collections' 
(C:\Users\tecnico.ricardo\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)
(venv01) PS C:\Users\tecnico.ricardo> 


-- 
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/78d15bc6-f58b-43e1-baaa-4e255e974dd1n%40googlegroups.com.


Class based views with forms

2022-04-26 Thread alex smolyakov
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/18a42d87-5c8a-46d6-b0ae-01ef8575eb96n%40googlegroups.com.


Re: Error django.db.utils.OperationalError: no such column:

2022-04-26 Thread Miracle
Did you run migrations???

You should run `python manage.py makemigrations` and then `python manage.py
migrate`

On Tue, Apr 26, 2022 at 8:37 AM Israel Lewis  wrote:

> Hello guys,
>
> I'm having an error in my models when I add the FK to the faculty or the
> student.
> model.py
> from django.db import models
>
> # Create your models here.
>
>
> class Student(models.Model):
> first_name = models.CharField(max_length=100)
> last_name = models.CharField(max_length=100)
> reg_no = models.CharField(max_length=20, unique=True)
>
> def __str__(self):
> return self.first_name
>
>
> class Faculty(models.Model):
> faculty_name = models.CharField(max_length=100)
> student = models.ForeignKey(Student, on_delete=models.CASCADE)
>
> def __str__(self):
> return self.faculty_name
>
>
> class Course(models.Model):
> course_name = models.CharField(max_length=100, unique=True)
> faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)
>
> def __str__(self):
> return self.course_name
>
>
> class Dean(models.Model):
> dean_name = models.CharField(max_length=100)
> faculty = models.OneToOneField(Faculty, on_delete=models.CASCADE)
>
> def __str__(self):
> return self.dean_name
>
>
> class StudentRequest(models.Model):
> student_name = models.CharField(max_length=100)
> faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)
> course = models.ForeignKey(Course, on_delete=models.CASCADE)
> reg_no = models.CharField(max_length=20)
> reasons = models.CharField(max_length=300, null=False)
>
> def __str__(self):
> return f"{self.student_name}"
>
>
> class FinancialRecords(models.Model):
> ACADENIC_YEAR_CHOICES = [
> ('Year 3 Sem 2'),
> ('Year 4 Sem 2')
> ]
> PAYMENT_PLAN_CHOICES = [
> ('Full'),
> ('Follow'),
> ('Fail'),
> ]
>
> payment_plan_category = models.CharField(
> PAYMENT_PLAN_CHOICES, max_length=10)
>
> student_reg = models.ForeignKey(Student, models.CASCADE)
> academic_year = models.CharField(ACADENIC_YEAR_CHOICES, max_length=20)
> course = models.ForeignKey(Course, on_delete=models.CASCADE)
>
>
>
> Errors
> Traceback (most recent call last):
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/utils.py",
> line 89, in _execute
> return self.cursor.execute(sql, params)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py",
> line 477, in execute
> return Database.Cursor.execute(self, query, params)
> sqlite3.OperationalError: no such column: exams_app_faculty.student_id
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/core/handlers/exception.py",
> line 55, in inner
> response = get_response(request)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/core/handlers/base.py",
> line 197, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/options.py",
> line 683, in wrapper
> return self.admin_site.admin_view(view)(*args, **kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
> line 133, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/views/decorators/cache.py",
> line 62, in _wrapped_view_func
> response = view_func(request, *args, **kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/sites.py",
> line 242, in inner
> return view(request, *args, **kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
> line 46, in _wrapper
> return bound_method(*args, **kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
> line 133, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/options.py",
> line 2063, in changelist_view
> "selection_note": _("0 of %(cnt)s selected") % {"cnt":
> len(cl.result_list)},
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
> line 302, in __len__
> self._fetch_all()
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
> line 1507, in _fetch_all
> self._result_cache = list(self._iterable_class(self))
>   File
> "/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
> line 57, in __iter__
> results = compiler.execute_sql(
>   File
> 

Re: Support d'aide en Django

2022-04-26 Thread Israel Lewis
hello i am new in django and i would like to use it with react native. and 
for that I have to combine django and postgres . need a guide, any help 
will be precious to me (support, site, course etc...) cordially

Hello 
I think you can go about this in two ways, 
1. you can start your project with the sqlite and later migrate to 
postgress 
2. start with postgress at once 
https://www.calazan.com/migrating-django-app-from-mysql-to-postgresql/  you 
can follow that guide to setup postgress.


On Thursday, 21 April 2022 at 22:48:05 UTC+3 diakitedj...@gmail.com wrote:

> Bonjour je suis nouvelle en django et j'aimerai l'utiliser avec react 
> native. Et pour cela je dois combiner django et postgres . Besoin de guide 
> , tout aide me sera précieuse ( support , site,  cours etc...)
>
> Cordialement
>

-- 
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/6f0f2210-c330-4a3c-af94-ea3d76787864n%40googlegroups.com.


Re: Django FormTools

2022-04-26 Thread Israel Lewis
1. Are you using a model form?
  if so, after you have check the request you can use 
   Post.save()***post as the model name for example.
2. for styling use  https://django-crispy-forms.readthedocs.io/ or create 
widgets with in the for and add the classes for each input. 
 
Hope this help you out.

On Thursday, 21 April 2022 at 22:47:57 UTC+3 ahmeddo...@gmail.com wrote:

> hey everyone i'm using Django with wizard form and everithing work fine 
> but i don't know how to styling inputs
> and i don't know how to save data on my database.
>
>

-- 
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/337b5b92-4379-44a6-8c89-0eb65b35e342n%40googlegroups.com.


Error django.db.utils.OperationalError: no such column:

2022-04-26 Thread Israel Lewis
Hello guys,

I'm having an error in my models when I add the FK to the faculty or the 
student.
model.py 
from django.db import models

# Create your models here.


class Student(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
reg_no = models.CharField(max_length=20, unique=True)

def __str__(self):
return self.first_name


class Faculty(models.Model):
faculty_name = models.CharField(max_length=100)
student = models.ForeignKey(Student, on_delete=models.CASCADE)

def __str__(self):
return self.faculty_name


class Course(models.Model):
course_name = models.CharField(max_length=100, unique=True)
faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)

def __str__(self):
return self.course_name


class Dean(models.Model):
dean_name = models.CharField(max_length=100)
faculty = models.OneToOneField(Faculty, on_delete=models.CASCADE)

def __str__(self):
return self.dean_name


class StudentRequest(models.Model):
student_name = models.CharField(max_length=100)
faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE)
course = models.ForeignKey(Course, on_delete=models.CASCADE)
reg_no = models.CharField(max_length=20)
reasons = models.CharField(max_length=300, null=False)

def __str__(self):
return f"{self.student_name}"


class FinancialRecords(models.Model):
ACADENIC_YEAR_CHOICES = [
('Year 3 Sem 2'),
('Year 4 Sem 2')
]
PAYMENT_PLAN_CHOICES = [
('Full'),
('Follow'),
('Fail'),
]

payment_plan_category = models.CharField(
PAYMENT_PLAN_CHOICES, max_length=10)

student_reg = models.ForeignKey(Student, models.CASCADE)
academic_year = models.CharField(ACADENIC_YEAR_CHOICES, max_length=20)
course = models.ForeignKey(Course, on_delete=models.CASCADE)



Errors
Traceback (most recent call last):
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/utils.py",
 
line 89, in _execute
return self.cursor.execute(sql, params)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py",
 
line 477, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: exams_app_faculty.student_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/core/handlers/exception.py",
 
line 55, in inner
response = get_response(request)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/core/handlers/base.py",
 
line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/options.py",
 
line 683, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
 
line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/views/decorators/cache.py",
 
line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/sites.py",
 
line 242, in inner
return view(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
 
line 46, in _wrapper
return bound_method(*args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/utils/decorators.py",
 
line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/contrib/admin/options.py",
 
line 2063, in changelist_view
"selection_note": _("0 of %(cnt)s selected") % {"cnt": 
len(cl.result_list)},
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
 
line 302, in __len__
self._fetch_all()
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
 
line 1507, in _fetch_all
self._result_cache = list(self._iterable_class(self))
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/query.py",
 
line 57, in __iter__
results = compiler.execute_sql(
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py",
 
line 1361, in execute_sql
cursor.execute(sql, params)
  File 
"/home/israel/Desktop/exams-clearance/env/lib/python3.8/site-packages/django/db/backends/utils.py",
 
line 103, in execute
return super().execute(sql, params)
  File