Dmitry
No
Any model created after post request?
Michael the wolf 🐺
try print(request.POST) and check if the data is there actually
Renad
Renad
I guess you use built-in user model. Can you share code of UserForm class?
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UserForm(UserCreationForm):
email = forms.EmailField(widget=forms.TextInput(attrs={'placeholder': 'Email Address'}))
gender = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter your gender M for male F for female'}))
date = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter a date'}))
certificate = forms.FileField()
class Meta:
model = User
fields = ('email', 'username', 'password1', 'password2', 'gender', 'date', 'certificate')
Renad
Dmitry
what happens when you're submitting the form?
Renad
goes back to the form again
Renad
Any model created after post request?
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UserForm(UserCreationForm):
email = forms.EmailField(widget=forms.TextInput(attrs={'placeholder': 'Email Address'}))
gender = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter your gender M for male F for female'}))
date = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter a date'}))
certificate = forms.FileField()
class Meta:
model = User
fields = ('email', 'username', 'password1', 'password2', 'gender', 'date', 'certificate')
Renad
Dmitry
I guess your form isn't valid and everything after if form.is_valid(): isn't reached.
you should check which fields in user model are required and specify them in your form
Renad
Umar
Renad
Hasan
Renad
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class UserForm(UserCreationForm):
email = forms.EmailField(widget=forms.TextInput(attrs={'placeholder': 'Email Address'}))
gender = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter your gender M for male F for female'}))
date = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Enter a date'}))
certificate = forms.FileField()
class Meta:
model = User
fields = ('email', 'username', 'password1', 'password2', 'gender', 'date', 'certificate')
I already did it in here but why this isn’t correct?
Dmitry
Renad
Umar
Dmitry
in the same order?
https://docs.djangoproject.com/en/3.1/topics/auth/customizing/
It seems to me the easiest way to create custom Account model is to inherit the built-in user model in one to one relation. Check the "Extending the existing User model"
Renad
Umar
You can create another model say profile then link User model by onetoone relationship with profile
profile will contain additional information about users
Anonymous
I'm trying to create a simple view on django but the app url is not displaying, i'm still geting the rocket home page as if i didn't include the app url. i can't find what is wrong with the code
Anonymous
I'm trying to send a screenshot of the code but is saying access denied
Anonymous
Show us your code
Mirco
Doragonsureiyā
I'm trying to send a screenshot of the code but is saying access denied
To share code or error tracebacks, be considerate and use an online pasting service - here is a list of suggested sites:
- https://del.dog
- https://dpaste.org
- https://linkode.org
- https://hastebin.com
- https://bin.kv2.dev
If you post a wall of text message (many lines), delete it quick or you may get a warn strike.
Anonymous
'tiredapp url'
from django.urls import path
from . import views
urlpatterns = [
path('', views.home),
path('api/', views.SendLocation.as_view())
]
Anonymous
'tiredproject url'
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('tiredapp.urls'))
]
Anonymous
def home(request):
return HttpResponse('<h1>Hello from Sylva</h1>')
Anonymous
I can't see what is wrong with the code
Anonymous
I get this error
Anonymous
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/app/
Using the URLconf defined in warapiproject.urls, Django tried these URL patterns, in this order:
admin/
The current path, app/, didn't match any of these.
Anonymous
when i try to put a slash on the app url
Anonymous
urlpatterns = [
path('app/', include('tiredapp.urls'))
]
Anonymous
There's no admin/ in the url but for some weird reason, django is seeing admin, i deleted since because i don't need it
лямбдλ
Hello, what book would you recommend for learning Django.
лямбдλ
Mirco
Doragonsureiyā
thanks
You're welcome! 😊
лямбдλ
can you advise, whether to read the book
Django 3.0 Vladimir Dronov.
лямбдλ
Many thanks,
I'm sorry to trouble you.
Anonymous
Favour Afenikhena:
Good day
I am new here
I am sorry for this request but I am having an error in my django project
I am using django hosts but when I am logged in . In my main domain I am not logged in . In my other subdomain
Ghorz
Felipe
Hey guys, how u doing?
I'm with a problem with the DRF pagination URLs. The requests are made from an HTTPS URL, but in the pagination the links are with HTTP.
Has anyone been through something similar?
Sarxt
hello Guys
Sarxt
I need help in creating a business/ ecommerce website with django and I'm a novice
Anonymous
Django.db.utils.OperationError:
no such table: AppName
Anonymous
Hello everyone
Anonymous
Anonymous
You, Help me please
Anonymous
Anonymous
What is mistake
Maybe you created this model but forgot to migrate the database
Anonymous
Django serializer responding output multiple times, the same output..I found that it's doing it for every object of that particular serializer class
Anonymous
How to resolve this
Naresh
data=xyz(parameters)
response=request.post(url,data=json)
return response
When I tried this am getting error like
Type Error 'module' object is not iterable
How to solve this
Agent Q
Agent Q
Naresh
Agent Q
array
Its not in an array
Naresh
Agent Q
Naresh
The parameters am passing are like this
{'parameters':[{
'name':'naresh',
'age':25}]}
Naresh
Make it an array.
The parameters am passing are like this
{'parameters':[{
'name':'naresh',
'age':25}]}
Agent Q
Naresh
Agent Q
Anonymous
Naresh
Agent Q
Naresh
yes
When I tried it giving error
dict object has no attribute dump