Qureshi
Dark
Colleagues, how to display tags with name and slug in DRF from django-taggit ? the django-taggit documentation has tags = TagListSerializerField(), but it only outputs the tag name itself, and I need to make sure that in addition to the name there is a slug that I could use for filtering on the frontend.
Now it looks like this:
"tags": [
"📝 Django",
"🐍 Python",
"📘SQL"
],
I need like this:
{name: "📝 Django", slug: "django"}
Nasir Ahmad
Hello to all
I bought a vps and domain from the hostinger site and connected the domain to the site's IP through cloudflaer, we used ubuntu 20.04 in the vps, and I wanted to deploy my django project, I used apache2 for this, everything is fine and there is an error I don't have either, but when I go to the domain or IP of my site, a default ubuntu page is displayed
Umut
Class ClubJoin(model):
User = model.foren(User, ....)
  Club = model.foren(Club, ....)
Views.py
Def clubjoin(request):
Saves = ClubJoin(user=request.user.id, club=?).save()
Umut
Suren
I am trying to add comments on product page, but after comment was added I want user to stay on the same page and view his/her comment. Don't want to redirect to another page.
I have done everything , form is showing properly and when I am clicking submit comment I am getting error as below in terminal:
Method Not Allowed (POST): /uzbekistan/tours/historical/uzbekistan-classsic-tour/
Method Not Allowed: /uzbekistan/tours/historical/uzbekistan-classsic-tour/
In Browser it shows as below:
This page isn’t working
HTTP ERROR 405
urls.py:
https://dpaste.org/n8gAH
template:
<form method="post" enctype="multipart/form-data" action="{% url 'tour' cat_slug=tour.cat.slug tour_slug=tour.slug %}">
Views.py:
https://dpaste.org/JoCAA
Is there any way to make it work?
Daniel
hello guys, how do i iterate over fields of an instance?
Daniel
I tried: instance._meta.get_fields() but it gives me 1 field only :'v
Maxim
hello guys, How can I put in the ckeditor things like this
<div id="vk_playlist_-2000891248_13891248"></div>
<script type="text/javascript" src="https://vk.com/js/api/openapi.js?169"></script>
<script type="text/javascript">
(function() {
VK.Widgets.Playlist("vk_playlist_-2000891248_13891248", -2000891248, 13891248,'36878f119df6d8cd23');
}());
</script>
When I insert the window is empty, but it is there
Dmitry
hello friends !
How do realize it in django rest framework ?
UPDATE person
SET
age = 25, weight = 55
WHERE
gender = 'female' AND age = 65 AND weight = 85;
Simple way for single row is generics.UpdateAPIView
But how it works with multiple rows ?
Kiran
After deployment of django project in railway can we change the domain name of railway instead of web-production etc to our name???
Doragonsureiyā
.
i wanted to update an object so i did this:
worker = Worker.objects.get(worker_id=pk)
form = StaffForm(instance=worker)
if request.method == 'POST':
department_instance = request.POST.get('department')title_instance = request.POST.get('title')
worker.depart_staff = department_instanceworker.title_staff = title_instance
worker.name = request.POST.get('name')worker.save()
return redirect('home')
when i save i can change the name but not the department and the title 'they are foriegn keys in worker model
then i changed the code to
worker = Worker.objects.get(worker_id=pk)form = StaffForm(request.POST or None, instance=worker)
if request.method == 'POST':
if form.is_valid(): form.save()
worker.save() return redirect('home')
now i can edit the department field and the title
why in the first one i couldn't manage to change those foriegn keys fields??
(₤ام͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـ͠ـیر͠
I have a problem with reset password complate in Django.
I managed to customize the reset password form in Django.
But for now, I am going to customize the password change(password-reset-complate) page that the user enters by clicking on the password reset link.
Bujji
Hi
How can I transfer a CSV file from laptop to mobile in Django?
Can anyone help me with this. . .
Charly
Bujji
I mean using python
Doragonsureiyā
I mean using 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.
Bujji
Thank you
Jayanthi
I am getting score 2 I'd diffrent ... Help me ... Sos
Jayanthi
https://nekobin.com/gizolosepa
Jayanthi
I am not get the proper college if and branch id
Charly
Jayanthi
print(score2.values_list("coll_id"))
print(queryes.values_list("coll_id"))
Jayanthi
<QuerySet [(1.0,), (1.0,), (1.0,), (1.0,), (1.0,), (1.0,), (1.0,), (2.0,), (2.0,), (2.0,), (2.0,), (2.0,), (3.0,), (3.0,), (3.0,), (3.0,), (3.0,), (4.0,), (4.0,), (4.0,), '...(remaining elements truncated)...']>
<QuerySet [(5.0,), (5.0,), (5.0,), (9.0,), (48.0,), (6.0,), (6.0,), (5.0,), (6.0,), (48.0,), (6.0,), (48.0,), (21.0,), (6.0,), (1.0,), (3.0,),
(6.0,), (57.0,), (141.0,), (9.0,), '...(remaining elements truncated)...']>
Jayanthi
I need same result in the second result of query set first query set
Jayanthi
Charly
Jayanthi
I have ordered... But it is not taking
Charly
Jayanthi
queryes = SecondExtendedRoundGeneral2021.objects.filter(
**{f"{category}__gte": rank}).values_list(category).order_by(category)
Charly
Jayanthi
What ever i get the college I'd and branch id from the first query Orderby will be the branch id and college I'd for the second query
Charly
Sorry I dot understand you
Charly
But the second query has no order at all
Kapil
please answer me
Doragonsureiyā
please answer me
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.
Kola
hi all. why the modules in the administration may not work. and the migration fails. there are no errors, it just doesn't work. I've been stuck with this problem for two days.
The Black Dev
Kola
My migrations file is red and empty. who knows what to do with it
Daniil
Hello. Maybe someone will tell. From the view, I pass the variable (hls) into the base.html template, it displays the page https: //...., a player has been added on the page, which turns on the video when it meets the link. I'm trying to implement: a button (Open code) has been added under the player, by which I go to another code.html page and I want to display the player code there, I wrapped the code in the <pre></pre> tag. The question in the future is how to pull out the hls variable so that on the code.html page in the <source src="https://......> tag it is displayed, and this path will change depending on the video that comes there.
Kola
Kola
Kene
Kola
Dmitry
Maxim
Abhishek
I am getting an issue in django admin. I have a model named "Goals" and it has some foreign key relationships with other tables. However, when I try to create a goal through the admin panel and update the foreign keys, I get the following error : "Cannot force an update in save() with no primary key in django". But if I try to omit all the foreign key values and enter only char or boolean field values, the record gets created perfectly. Can anybody help?
Badal
How can i call redirect function with parameters
Kola
first I create a model with a class, then I just add it to the administrator.
Its all
rajat
Hello frnds... I need to encode a object ---> send to particular url--> and decode their. While i am trying it is decoding to string not to object. How to encode and decode a object using django??
danial
Hello friends
I am customizing the Django user and I want to remove the default password field
Can you guide me?
Mirco
LStyle
is anyone using StreamingHttpResponse? what is it for
Binary
LStyle
Иван
Hi. Does anyone now how to annotate ordinal number for each object in query?
Sai
Why am i getting no such file or directory error even though i have the file in that directory
Doragonsureiyā
Why am i getting no such file or directory error even though i have the file in that directory
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase
Sai
Im doing a project on a webpage creation which includes multiple pages
But i have a error showing manage.py :no such file pr directory
Im using django using python backend
And im running the script in the visual studio code (explorer)
Im using python 3.11.1
I am a student who is new to this
Mirco
Sai
Yes i have created a virtual environment and also activated it
The Inspired
are you using git bash terminal?
The Inspired
open up a terminal and type ls. Do you see a manage.py file?
Sai
No sir i have not activated the venv i will do it
Suren
can anyone tell please if one form I am displaying on two different pages, so I have two different styles for that form. I know that in widget of form field I can write:
'class': 'subsriber-form__text-input',
But how do I make it different for another page which requires another class?
LStyle
create another form?
rajat
in above code when i am trying to send obj to verify_otp, it convert as string. I need to send as object only
.
hello ,
i have two tables table 1 and table 2 , that i wnat to update. h have one html page and one view
in this view i wnat to check if the pk is ralted to table 1 then it will show the table 1 form with instance of the itme to update it , but if the pk was related to table 2 it will show the table 2 form with the instance of the item to update it
thank you very much
Suren
create another form?
But is it correct to create another form just for changing class only? For that form I have to create another view and another url as well