Doragonsureiyā
Hello sir,i am new in python so i really don't know much,so please can you help me to find a solution of the problem Write a programme to implement 8-puzzle using steepest ascent hill climbing in python?
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Ali
from django import forms class AdminUserForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class Meta: model = User fields = ('first_name', 'last_name', ) fieldsets = ( ("Personal Information", { 'classes': ('wide',), 'fields': ('first_name', 'last_name'), ) fieldsets didn't apply only fields works please help 🆘
Ali
I think fields must be list or no?
not nessacary, any type of iterator like (tuple, list) works
Kelvin
Learn htmx
Rahat
How to crate customuser admin in drf
Charly
How to crate customuser admin in drf
In admin you create objects as any others, but it has nothing to with drf
Mekdim
i'm facing a problem with rendering back the datas on the html page i have model with pdf   = models.FileField(upload_to='Files/',db_column="PDF" ,null=True,blank=True) then inside my view  def pdfViewPage(request,id):     try:         currenSelectedPdfItemObject = PdfInformation.objects.get(id = id)         context = {             "pdf":currenSelectedPdfItemObject.pdf,             "tittle":currenSelectedPdfItemObject.tittle         }         return render(request, 'pdfView.html',context)     except:         pass     the problem rises now when i try to render the pdf on the webpage here is the code from the template file  <div class="mainPdfDisplayHolder">         <div id="pdf">           <object class="mainPdfDisplay" data="{{ pdf.url }}" width="80%" height="90vh" style="border: 1px solid black;">           </object>                   </div>     </div> 👆 this won't display the pdf file i don't really get it what i am missing here , when i try if the file works like the base url with the file path the pdf file will displayed but when it comes to the template it won't open i've tried embed and iframe also but doesn't seem to work and i am stuck here for about day any suggestion would be appreciated thanks u!
Krishnajith US
Hi i amt trying to deploy my website.i have both frontend and backend.i needed to run both gunicorn and Daphne.i am hosting my frontend in netify.The normal https request working fine.It comes to nginx and then passes to gunicorn but the when I use pass request to web socket it tells there no path exist..i already configured the path in nginx
Ray of Hope
Run both usgi and wsgi using supervisor
Krishnajith US
I am using already using systemd
Ray of Hope
Use redis and try
Charly
Use redis and try
That has absolutely nothing to do with the issue
Ray of Hope
Yh that qn was part of global warming
Ray of Hope
https://youtu.be/zizzeE4Obc0
Ray of Hope
Deploying django channel application using redis and daphne
Charly
Yh that qn was part of global warming
You don't know what's redis, right?
Ray of Hope
You better do some research
Ray of Hope
Link above
Charly
You better do some research
I know, but you don't understand the issue nor know what's redis
Ray of Hope
Yes sir😄
Charly
Yes sir😄
Then why redis is relevant for the issue?
(₤ام͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـیر͠
Hi i have a problem wiht django forms i have d ready html template and in this template in Login page i have a <form> for Login users and in django when we want to create a login page we use form.py and in Html file just write {{ form }} but this this , everything on the front will be destroyed. what can i do?
(₤ام͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـیر͠
Widgets form
i no but some of these classes are handmade in the front part(in the css)
(₤ام͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـیر͠
Happy
In create view i want to save that data in json format....help me how can i do that
.
How to make values_list return the str for each instance returned? I know that model.objects.values_list(‘fk_field’) returns a list of id’s of the referenced foreign key, e.g., [1, 2, 3, etc] How to make it return the str reference of each instance instead?
.
use the lookup
Is it related to this part of the documentation? https://docs.djangoproject.com/en/4.1/ref/models/lookups/ Please clarify what lookup do you mean.
.
values_list("fk_field__somefield") e.g. "booking__owner"
This doesn’t solve my question, since I need the str of the instance, not the field value. My def __str__ of the model doesn’t simply return the value of an instance’s field. It’s like I want “fk_field__str__”
.
Use map(str, values)
How and where should this part be?
Erfán.R
yo guys im getting this error but i dont know why models created correctly
Erfán.R
can anyone help please?
.
so u cannot 😊
Okay thanks guess I’ll just do it separately as inspired by David’s map hint str_list = [related_model.objects.get(id=val) for val in pk_list]
Gosha
Hello! I want to create a database, but only some of the fields are being created, please help
Gosha
During migration, 2 fields are created, and there are 5 in total
Rutya
Hi I will create change password API in django rest framework but stuck plz guid me
Suren
Dear friends, I have simple subscription form as below: try: if Subscribers.objects.values('email').get(email=subscribers_form.data['email']): messages.error(request, 'Email already exists') except: pass I get this message "Email already exists" only in admin panel, but how have it popped up on website for user? Now it is not giving any error and just redirecting to homepage.
.
I think no, I guess this is the only message I am trying to display
Make sure you have {{ messages }} variable in your template, put it where you want the message to appear.
Suren
Make sure you have {{ messages }} variable in your template, put it where you want the message to appear.
If I put it inside my template, I get this message appeared - <FallbackStorage: request=<WSGIRequest: GET '/'>>
.
If I put it inside my template, I get this message appeared - <FallbackStorage: request=<WSGIRequest: GET '/'>>
Sorry I forgot to specify loop through it like this {% for message in messages %} {{ message }} {% endfor %} And then style it as you wish.
Purushottam
I Want to show the model data in tablist based on status(complete, in progress). Currently it is coming on only in one page snd using filter option to get particular status data..
Purushottam
Can someone help how this can be achieved
virat kohli
Can anyone how create multitenancy using docker way in django
.
In django admin if you have a model called Player and when you want to create an object of this model you need to relate the player object - before you click save - with a team filed and this field is a foreign key in Player model I want to be able to create a team object within the player form before clicking save. like what i can do in django admin panel
.
Hi, is there any way to make to ways to make an account? I mean I want to make two different types of account First one when you make it you can buy things and put them on court, the other one when you create it you will have the ability to sell things and receive money. How can i find how to do that?
.
i'm trying to update a staff object that has department forign key and i still get this error Cannot assign "'1'": "Staff.department" must be a "Department" instance.
.
before worker.department = request.POST.get('department') i tried to do somethind like: worker.department.name = request.POST.get('department') the error stop accouring but wehen i click save nothing changed
.
I don't have problems with the creating of the object, just with the updating
Rutya
How create django rest framework api in django
Rutya
In Change password API
Frank
Please I am new to django How to i run already created project on my terminal
Frank
Python manage.py runserver
Can I send pictures or the errors I getting @admin
Frank
Python manage.py runserver
It was showing error sir
Ankit
It was showing error sir
Run this command inside your project folder try this
Doragonsureiyā
Can I send pictures or the errors I getting @admin
To share code or error tracebacks, use a pasting service, like: - https://linkode.org - https://dpaste.org
Unknown
Hello I want help. I host my django web application in AWS EC2, but its Media folder is not working, Images that are uploaded by users are not visible on the website. I connect using nignx and gunicorn. Any idea?
Vladislav
raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. Hello, how to decide this problem ?
Charly
raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. Hello, how to decide this problem ?
Well there are many reasons that can happend more likely you are importing something from apps on the settings or something like that but we cant help more without more details
Vladislav
When i added context_processors this exception appeared
Charly
When i added context_processors this exception appeared
Im reffering tot he piece of code that caused the error please dont share everything