django

Django-admin uploading multiple photos at a time?

Hello. For a project, I need to be able to upload multiple images (different amounts) for each product. A good example is any ... first collect the photo in a zip, and then send it to the current. But I can't choose a few photos myself django version 2.2

Django / Python does not follow links to html pages. How do I fix this?

I wanted to create a simple bulletin board (I just started learning Django). One of the tasks was to create several html page ... nclude urlpatterns = [ path("admin/", admin.site.urls), path('advertisements/', include('advertisements.urls')), ]

Enabling css in a Django template

Good day to all! I have a project" proj " on Django, it created an application "blog". In the file "..../proj/blog/templates/ ... pecify the path that would be when calling render_to_response('page.tpl', context) Did the generated page find the css file?

Compare the list with ManyToMany in Django

The list members is given. It contains instances of the User class. You need to check whether all the elements of this list a ... quest.user] if Dialog.objects.filter(members=members): # Проверка на идентичность списков return redirect('/')

The image is not displayed in django

I do not display the image in django, but if you do it through admin, everything works. I need a user to do this, not an adm ... p> </div> </a> </div> {% endfor %} {% endblock content %}

WebSocket in Django

I started working with websockets for the first time in my life and this error occurred. I have already used the tips to inst ... l" async def websocket_view(socket): await socket.accept() await socket.send_text('hello') await socket.close()

Error when migrating python django

TypeError: init() missing 1 required positional argument: 'on_delete' This error occurs during migration. status = models.ForeignKey(Status) Code that seems to be causing problems. How to fix it?

Dynamic forms on django

I am creating a web application for my hand-to-hand combat club and am developing for the first time in Django. I have mode ... d my problem because this is the first time I am addressing problems on the forum. I will be grateful to those who will help.

include in django

I try in the file urls.py execute from django.contrib import admin from django.urls import path, include app_name = 'mywebch ... pp_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead. What to do?

Django. CSRF token mismatch in the template and in cookies

The standard situation is processing an HTML form in Django. The template in the form is spelled out {% csrf_token %}, as it ... is the security here, in fact, when the token value can be taken from cookies or from the hidden input of the form itself??

How to upload a Django website to hosting?

I have a website on Django that is already ready and needs to be uploaded to hosting. To do this, I use the FileZilla program ... t found. That is, looking for index.html. And the problem is that I use Django and I have this file in the templates folder.

Substituting their own values in the ForeignKey fields for ModelForm Django

Faced with the problem of output of human-readable values from ForeignKey via the ModelForm form. ForeignKeys are output as D ... s-adds entries to the Order table with a ForeignKey But it looks like this: And it should look like this and still work:

How can I calculate the number of days between two dates in Django so that I can calculate the amount for my stay?

There is an app for online booking in Django. You need to make a function that will count the difference between two dates ( ... erbose_name="Дата отъезда") ? days_ is_verificated = models.BooleanField(default=False, verbose_name="Подтверждён?")

Can I create my own REST queries?

There was a stupid question about the types of REST requests. I understand that these methods are generally accepted: POST-cr ... se a generally accepted method for some actions? (For example: Send DELETE, but create a new object instead of deleting it.)

Why aren't lines with fuzzy translated in django. po?

I update the django.po file this way: $ python manage.py makemessages -l ru $ python manage.py compilemessages -l ru After t ... ile the application is running. For example, when #, fuzzy msgid "view" msgstr "показ" Instead, the display will be a view.

How to run a GIT project in Python+Django?

There is a mini project in python (2.7) + django (1.11). For convenience, virtualenv is installed. The whole project has a st ... hanged (along the path Lib\site-packages) (do not put the entire folder in git). It is forbidden to use Docker on the server.

How do I call a python (django) script when I click a button on an html page?

There is a function for creating a random number in python (django) def generate_code(): random.seed() return str(random.randint(10000,99999)) How do I execute this code on an html page when a button is clicked?

How do I get data from a linked model?

I need to display a list of products on the main page of the site. The problem is that I do not know how to display the produ ... %} Question : How to get queryset product photos to display them on the product list page.(Random or first of each product)

NOT NULL constraint failed: studentapp studentproject.project owner id

Model: from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.db import ... rors, status=status.HTTP_400_BAD_REQUEST) Mistake: NOT NULL constraint failed: studentapp_studentproject.project_owner_id

How do I write an ORM on this? Subquery

DELETE FROM news WHERE id IN (SELECT id FROM news ORDER BY id DESC LIMIT 100) Delete the last 100 records from the table