Varun
Actually I'm facing issue while hosting django app in cpanel.. .everthing is running fine in heroku but in cpanel whenever I open any URL, it shows URL not found. even both django version of my project and cpanel are same. (what could be the possible mistakes) Anyone please help!!!
Bahar
hey guys I have several classes in my project. I want to write a code that when a user enroll in the class the information of them are sent to admin panel. I mean admin have accessed to each list of people's information who have enrolled in the class. how can I implement it?
Shreehari
Hey guys how can i optimize the below code ? https://del.dog/grorottefe.txt There's only 2 objects created for this model im using. Any help would be appreciated
cj
U r right. It's bcoz It's little tough for me to understand docs in deep. I am a beginner.
django's documentation is one of the best open source projects documentation, everything is covered and clearly explained, there's no other place where you can learn Django best if it's not reading its docs
Bahar
Just registering that model in admin will suffice ..what do u think
you mean I should consider another model for enroll section?
M
you mean I should consider another model for enroll section?
What I meant is u must be using a model to store the user information । Just register that model in admin to that model information will be available to admin ।simplest way I can think of
Bahar
What I meant is u must be using a model to store the user information । Just register that model in admin to that model information will be available to admin ।simplest way I can think of
yes , now I understand what you said. I think you haven't get the whole problem, I have users model and I have classes modes for example the admin represents 10 classes. class 1 class 2 .... class10 and almost 100 users logged in my site and want to enroll in the classes. for example user1 .... user10 enroll in class 1 I want to put the information of these 10 users as the people who have class1. and when the admin needs to see how many people or who have enrolled in class1 just go to admin panel. click on class1 and see the people's information
Bahar
Why dont u use a user registration model
register users in admin.py just put all the users in admin panel. I want to classify the users who have the same class!
Bahar
or I'm missing something?!
Anonymous
by foreign key?
Try foreign key Or just another field in yr user model for storing class informations
Anonymous
Bahar
Another field inside yr model
is it different from foreign key ?
Anonymous
Insert or update on table "django_admin_log" violates foreign key constraint "django_admin_log_user_id" DETAIL: key(user_id)=(16) is not present in table "auth_user" Guys how can i fixed this error?
Anonymous
is it different from foreign key ?
class yourmodelname(models.Model): class = models.CharField(max_length=30)
Anonymous
and how can I send this to my database?
U having a user model? Right..
Anonymous
yes I have
Then add that and migrate
Bahar
U having a user model? Right..
I mean can I do something to classify my data? show them neat: class1: user1 user2 user3 class2: user 4 user5 or something like that?
Bahar
I want to be accessible for admin to read data easier!
Bahar
Do one user have more than one class?
yes there is no limits for him
Anonymous
I want to be accessible for admin to read data easier!
If u have a UI for admin to view Then you need to query the data according to your need
Anonymous
yes there is no limits for him
Every class is having a id Then add that Id to user model like foreign key or use json field if u having more than a class to a single user
Anonymous
for admin I just have admin panel. is it your mean?
Are you using django admin view Admin.register() ?
Anonymous
yes
Then register class model in admin view
Anonymous
So you can see users in each classea
luci._
someone knows how to do this
luci._
i can not send media :c
luci._
it is a form with a lists
mukul
it is a form with a lists
Can you explain it more
Chitranshu
Hello😄
Chitranshu
Can anyone tell me some resourcrs to learn django
Chitranshu
I knew flask... With some basics
luci._
In a form I have a drop-down list of countries and I want to create a filter by container, so I want that when I select South America, only the countries of South America appear
Nurgazy
How deploy two project in nginx server and run?
luci._
continent*
Chitranshu
Please vuide mr
Chitranshu
Guide me*
luci._
I have a model with types of dishes and I must create a drop-down list that is updated every time I add a type of dish (salty, sweet, sour) I don't know if this goes in the forms.py file, view or directly in the template
luci._
class TipoPlato(models.TextChoices): """Tipo de plato""" DESCONOCIDO = "desconocido", "Desconocido" ENTRADA = "entrada", "Entrada" FONDO = "fondo", "Fondo" ENSALADA = "ensalada", "Ensalada" POSTRE = "postre", "Postre" REFRESCO = "refresco", "Refresco" # Other Fields Here... tipoplato = models.CharField( "Tipo de plato", max_length=20, choices=TipoPlato.choices, default=TipoPlato.DESCONOCIDO, )
luci._
i wrote this, but in this case the options are dynamics
luci._
i wrote that in models.py
dilip
Insert or update on table "django_admin_log" violates foreign key constraint "django_admin_log_user_id" DETAIL: key(user_id)=(16) is not present in table "auth_user" Guys how can i fixed this error?
U can do multiple things here like 1) create new user I'd and try with it 2)it says user I'd 16 is not present, so u can go to ur database and make I'd of ur user instance to 16.
dilip
Hey guys how can i optimize the below code ? https://del.dog/grorottefe.txt There's only 2 objects created for this model im using. Any help would be appreciated
By optimization if u mean to consume less cpu memory and more efficient, then you can write ur own vire definition instead of view class from restframework. And can avoid serializers too. This can speed up ur code by 70 to 80 percent
dilip
Do anyone have code for quiz website in django?
There's a django-quiz open-source library available on pypi.org. U have a good logic already made to start with
~~~
Can u explain ???
I have an external template and i need to connect generic view form with the external html form...i need to change the default html form design...
dilip
I have an external template and i need to connect generic view form with the external html form...i need to change the default html form design...
You can include ur design using include tag at beginning of html page.. U can refer to django template documentation. It's pretty straight forward
Muzaffer
hi guys, why I got the following error. I imported settings the top. 'SIGNING_KEY': settings.SECRET_KEY, NameError: name 'settings' is not defined
Muzaffer
from django.conf import settings like that? I did
Muzaffer
not working
Anonymous
Anonymous
not working
https://docs.djangoproject.com/en/3.1/topics/settings/ Go through this This may help
Muzaffer
'SIGNING_KEY': settings.SECRET_KEY, that is because of this line in settings. when remove settings it works
Muzaffer
thanks anyway
MT
hi dears how to resolve this re_path(r'category/(?P<slug>[-\w]+)/page/(?P<page>[-\w]+)/
Faisal
no🤦‍♀
Can i check out your code
mukul
see this message
Whenever children enter in the class update the admin pannel of the class Or many other ways to do that thing