Smile
in other words: how to assign a new created skill to a profile? and is it possible to do it in form_valid ?
FOR YOU
Hi, now I creating authentication in my project. Can you give me some books or resource about that, except documentation..
In project, I should use Django authentication (not custom)
Manoj
i am not able to update data
Manoj
def update_data(request, id):
if request.method == "POST":
pi = User.objects.get(pk=id)
fm = StudentRegistration(request.POST, instance=pi)
if fm.is_valid():
nm = fm.cleaned_data['name']
em = fm.cleaned_data['email']
pw = fm.cleaned_data['password']
upd = User(name=nm, email=em, password=pw)
upd.save()
return HttpResponseRedirect('/thanks/')
else:
pi = User.objects.get(pk=id)
fm = StudentRegistration(instance=pi)
return render(request, "enroll/updatestudent.html", {'form':fm})
Manoj
when i updae data in ui it creates a new entry in table
Manoj
what is wrong in this code?
Ivan
You are doing User(withdata).save() , that create a new record, you need to update an existent with two ways:
pi.name = nm
pi.email = em
pi.save()
or my favorite
updated_data = {
'name': fm.cleaned_data['name'],
'email': fm.cleaned_data['email'],
'password': fm.cleaned_data['password'],
}
User.objects.filter(pk=id).update(**updated_data)
and that's all
Fredrick
Has anyone used django-filters for dropdown only one category menu with class based views? if yes how is it done?
#django #Python
Yooo
in template/app/index.html
{% extends 'base.html' %}
{% block content %}
replace me
{% endblock %}
in template/app/base.html
<!doctype html>
<html>
<head>
<title>Base title</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
in app/urls.py
from django.urls import path
from app import views
urlpatterns = [
path('',views.index)
]
in app/views.py
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request,'app/base.html',{})
this is the code...!
Yooo
i have defined block content in base.html and extents in index.html , block content is not working
Suraj
Any one send to me voice chat and vedio chat in django
Charly
Hemraj
Евгений
Kapil
how to update all date at single click
Kapil
click on update all button
Rohit
Bro on local host while login csrf token working
Rohit
But after hosting its showing csrf forbidden error
Rohit
Anyone 🙏 plz help
FOR YOU
FOR YOU
I mean about next requests
Rohit
Shrey
Also you will have to modify ALLOWED_HOSTS and add your site or access point to CSRF_TRUSTED_ORIGINS inside settings.py too !!
Vasyl
Vasyl
And try to path index.html in views
JUGO
Somebody know why on my site I can't rewind video
Charly
Yooo
Charly
noob
Can anyone help
Sql query to get all flights from station a to b connecting and direct both in single table
Charly
Charly
noob
Charly
🔸Haku ⚒
I had a working website on Django. Suddenly, some styles stopped loading, I made no changes on the code, so after searching what could it be, I realized I am receiving a Content Security Policy error on the browser console, which says that my website config have blocked loading an inline resource for default-src. Any way to solve this?
Charly
🔸Haku ⚒
Charly
Ali
Hi I want to find the registration in Django so that when it receives the email and other information, it will be redirected to a page where it will enter the code that was sent to the recipient's email. If it is correct, the registration will be done.
How do I write this?
Yooo
Евгений
Hello. How can I solve this problem?
RuntimeError: Model class races.models.Racer doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
help pls
Qureshi
Anyone python django free course sent me please🙁
Евгений
Даниил
Евгений
Mihir
What option is better for realtime data ajax or django channel ?
Даниил
4.1.4
It seems that error inside your admin.py file
Евгений
Kenechi
Mihir
Ok tysm
Davide
hi do you have any tips on how to create a form by passing it a dictionary?
Himalaya
listdata = SchoolWiseScheduleDate.objects.annotate(item_position=Count('action')).filter(**{f'action-1{item_position}scheduled_datein': date_list})
Throw error --> NameError: name 'item_position' is not defined
Himalaya
Like I want to use item position value as to define a field key to filter data?
Himalaya
Anyone who can help?
Mr Moha
can i build full school managment system in django restframework and react as front end
vahid
https://stackoverflow.com/questions/74863899/django-test-discovery-issues
Mani
my_project
└── src
├── __init__.py
├── main.py
├── database.py
└── auth
├── __init__.py
└── repository.py
How can I import database.py in repository.py?
when I try to do, it says:
ValueError: attempted relative import beyond top-level package
No idea how to fix.
package in repository.py is auth
and name in repository.py is auth.repository
MultiValueDictKeyError in 'role'
def Registeruser(request):
if request.POST['role'] == 'Candidate':
role = request.POST['role']
fname = request.POST['firstname']
lname = request.POST['lastname']
email = request.POST['email']
password = request.POST['password']
cpassword = request.POST['cpassword']
Krunal
I am using django channels. It is working fine on windows server while running on development server. But it is not working on IIS.
Do I need to do any additional setttings in iis to run websocker? I have checked websocket is enabled in iis.
cj
Qureshi
🧚♂️
Hello
Have you ever encountered such an error ?
Error 8 connecting to redis:6379. nodename nor servname provided, or not known.
🧚♂️
It doesn’t work
......
Anyone know how to create Chat application API in django-channels for communicate with each other.
Doragonsureiyā
......
I am creating django restframework web API using django-channels for just like chatting web site.
🔸Haku ⚒
No
I was making some testings and if I deploy the project locally, it works well, so it probably has something to do with the server and not the code
maverick
Any one familiar with unit test
Doragonsureiyā
Any one familiar with unit test
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z!"
Just ask directly! The better you are at explaining the problem, the more likely you are to get help.
Asking smart questions
maverick
I need to test a csv upload and store the data into database. How to do the unit test for this ?