Sagar
127.0.0.1:8000/admin/logout/
still giving error
san
san
*view
Sagar
path("admin/", admin.site.urls),
im using this to login and logout. but im unable to logout
san
Don't you have view function for admin log out
Sagar
No, I'm using default django admin login logout
san
from django.contrib.auth import authenticate,login,logout
import this and try you may get
Sagar
And create a url for the above for logout?
san
no actually you need to create a view for logout
example :
def admin_logout(request):
logout(request)
# Redirect to a specific page after logout (optional)
return redirect('/admin_login')
url for this logout :
path('admin_logout',views.admin_logout,name='admin_logout'),
Sagar
Okay
bloodyru MTS
Sourav
can make network diagram on google maps using django rest framework
Sourav
Any One Help me?
Ekoko
Hello guys, has anyone installed Inventree with Django? I'm having some difficulties here to install and run Inventree
Dinesh
Mr. Achiever
Hello Team,
I'm writing an app in which there will be multiple universities which will have different colleges under them. I've used Foreign key option in models.
However, In the form, when I'm trying to select the universities and the college associated, it shows me the list of entire colleges from all the universities.
Can anyone guide me what can be the best option to achieve such a scenario in which only the specific colleges for the selected University is listed, and if I change the University, then only the colleges for that specific University should be shown?
clouded
Asyrof
Hello guys i have question, i 'm learning to create a website using django. Why doesnt my django website server accept the changes in my css and html? Even though i have connected the css with a static file
Charly
Asyrof
Yes friend
Asyrof
I mean, after i make changes to the html and Css files in VScode then i run the django server in a web browser there is no change at all
Charly
Asyrof
Thanks friend for helping me
Asyrof
Work it
Valentino
How to sanitizate code for htmx?
Charly
Maxim
@Donghanbari
rule #1: speak English
read only 1 hour
Adish CT
google is provided their new modulle you can use that in react
_
Did you import the app?
_
You have to add that in installed apps list
ford
Hello Guys, so today i come a cross funny thing in django, I have a model with three fields "name:str, comm:manytomany, active:bool" when creating the object I used get_or_create method, but even when object exist with same name it return none and tries to create a new object with same name which fails since name is unique field, has anyone ever experience same?
_
You also need to add client ID and secret key
_
Yeah then it should work
_
SOCIALACCOUNT_PROVIDERS = {
"google": {
"APP": {
"client_id": os.getenv("GOOGLE_CLIENT_ID"),
"secret": os.getenv("GOOGLE_SECRET_KEY"),
"key": ""
},
# These are provider-specific settings that can only be
# listed here:
"SCOPE": [
"profile",
"email",
],
"AUTH_PARAMS": {
"access_type": "online",
}
}
}
Do something like this
ford
Bhushan
In django celery incounter with the error object of type response is not json serializable
Charly
Bhushan
https://dpaste.org/JEe5V
Husen
hi guys!
CommandError: “pbkdf2_sha256$720000$PmQuZpkEJCev4nJfuv4f7r$iB6wCcqqwwu63Bk2ZILRpI/zWlDTyaO+npW3K3m2dIs=” value must be either True or False.
Husen
Husen
you are sending a string ( pwd hash ) instead of a boolean
from django.db import models
from django.contrib.auth.models import BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, full_name, email=None, password=None, is_staff=False, is_admin=False, is_active=True):
if not password:
raise ValueError("User must have a password")
if not full_name:
raise ValueError("User must have a full name")
user = self.model()
user.email = email
user.full_name = full_name
user.set_password(password)
user.admin = is_admin
user.staff = is_staff
user.active = is_active
user.save(using=self._db)
return user
def create_superuser(self, full_name, password):
user = self.create_user(
full_name=full_name,
password=password,
is_admin=True,
is_staff=True
)
return user
Pedram
from django.db import models
from django.contrib.auth.models import BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, full_name, email=None, password=None, is_staff=False, is_admin=False, is_active=True):
if not password:
raise ValueError("User must have a password")
if not full_name:
raise ValueError("User must have a full name")
user = self.model()
user.email = email
user.full_name = full_name
user.set_password(password)
user.admin = is_admin
user.staff = is_staff
user.active = is_active
user.save(using=self._db)
return user
def create_superuser(self, full_name, password):
user = self.create_user(
full_name=full_name,
password=password,
is_admin=True,
is_staff=True
)
return user
send model fields in self.model(username=username , email = self.normalize_email(email) , full_name=full_name
user.model(username=username , email = self.normalize_email(email) , full_name=full_name)
user.set_password(password)
user.is_admin = True
user.is_staff= True
user.is_active = True
user.save(using=self._db)
return user
Husen
Hominini_Inside
Hi! It's possible to build a development setup with multiple django workers for a project? With serving media and static files as with usual startserver tool? We have some solutions for these purposes?
Rohan Ekke
guys, i am getting error when submited django form:
<ul class="errorlist"><li>fetured_image<ul class="errorlist"><li>This field is required.</li></ul></li></ul>
Maxim
Rohan Ekke
ok
not able to figureout what to do
Rohan Ekke
Maxim
thank for your help
all that can be gleaned from your posts:
1. you are using Django
2. some field you missed must be filled in
that's not enough to help
Rohan Ekke
django.db.utils.IntegrityError: UNIQUE constraint failed
Rohan Ekke
∴
hi everyone. what is the most used swagger lib for django?
∴
there are many
∴
Mirco
Human
Rama Krishna
Where can I learn django? I'm very interested in learning django
So I started with DSA with python and completed it I solved 210+ questions on leet code. But I'm unable to find clear sources for learning django
Rama Krishna
I wish to make a portfolio website with django running on backend
Moein 🌱
Moein 🌱
Your quote on quote interest is not enough you have to work hard
Charly
ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ
Valentino
Be more specific
I was checking on internet and people says that htmx is insecure. And they was saying that we have to sanitizate code
Valentino
I don't now what it means
Valentino
So, if I have a Django form I need something else?
Valentino
Some func?
Никита
Bacanero
Ayúdemen necesito hacer reportes complejos en Django donde puedo encontrar información
cj
iam
Maxim
@techadarsh55
offtopic and crossposting
read only 24 hours both groups
P.S. don't ever ask pure Python questions here
عبید اللہ
May blog application working properly
But when pass urdu slug,
Return 404 error
How to fix
ali
How can I add slug into url of simple router and nested router in rest framework?
Mr. Achiever
clouded
Can you help me with an example?
https://simpleisbetterthancomplex.com/tutorial/2018/01/29/how-to-implement-dependent-or-chained-dropdown-list-with-django.html