Django answers

  • 0answers
    How to describe the behavior of a site template block in Django?
    Good day. There is a base.html template with search, authorization, feedback forms, and any other objects with business logic. How to interact with them from different views, different applications without duplicating code? It's obvious from the question - I'm making my first site in ...
    Django Anonymous, Oct 30, 2020

  • 0answers
    Is there a more elegant solution?
    Let's imagine there are two models models.py I need to display a list of all stores, but under each one display a list of phone numbers belonging to it. Solved for 2 days. And here's how I solved it ... class Store(models.Model): name = models.CharField(max_length=200) address = ...
    Django Anonymous, Feb 4, 2020

  • 0answers
    How do I add my own language code (eg ru, en) to Django?
    Hello everyone, there is a problem, in Dzhang the Kazakh language code is marked as kk, how can this case be changed? or say add your own code? Just install LANGUAGES = ( ('ru', _('Russian')), ('kz', _('Kazakh')),) It doesn't work with kz it gives 404 and with kk all the rules
    Django Anonymous, Sep 8, 2020

  • 0answers
    How do I add an image to the select option in django select2?
    I use Select2MultipleWidget to select multiple photos from the suggested ones. The photo model includes the title and the actual file and image. def __unicode __ (self) - returns the title. The widget works for me, but I need pictures in the selection option as well. Like this screenshot. ...
    Django Juliette Bates, Oct 16, 2020

  • 0answers
    How to display comments sorted by date added?
    There is a model, a view and a template model [[[ 0_0]]]
    Django Charles Dixon, May 6, 2019

  • 0answers
    How to restrict access to the admin panel for external IP?
    Question on the subject. I tried it like this: location ^~ /admin/ { proxy_pass http://localhost:8000/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For ...
    Django Sawyer Sanchez, Aug 15, 2020

  • 0answers
    Add photo to profile page using thubnails?
    Good afternoon!! Please tell me, I want to add an image to the page using sorl - thumbnails. Here is my code: My prayer: class Person(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) birthdate = models.DateField('Date of birth') ...
    Django Isla Matthews, May 29, 2019

  • 0answers
    How do I attach multiple photos to a post?
    Hello everyone! There is a model so that when creating a post, the user can attach their photos! I see such an option (probably one of the simplest), it is to add an additional model QueryImage, and use inlineformset_factory to make a form for images: class Query(models.Model): # ะบ ...
    Django Sebastian Medina, Oct 25, 2019

  • 0answers
    How to set up nginx + django?
    For two days now I have been suffering with the deployment of django + nginx, read a bunch of articles, but nothing helped. Please write a detailed instruction for ubuntu. Thanks in advance
    Django Daphne Kent, Jun 16, 2020

  • 0answers
    How to implement interaction between two users?
    It is necessary to enable two users to go to one page (for any other users, it therefore becomes closed) and perform actions that will be displayed in real time. The question is, is it possible to do this using the methods described in the tags, if so, how (at least the logic, and where to look), ...
    Django Anonymous, Oct 19, 2020

  • 0answers
    Pagination with django filters?
    Hello! It was necessary to make filters for QuerySet based on the GET parameters of the request that are sent by the form. But the trouble is that there is pagination, which, it is desirable, to bind to GET parameters too. For the first page, the filters work and the URL looks like this: ...
    Django Anonymous, Jun 13, 2019

  • 0answers
    How to access login_required url?
    Yes means url: url(r'^links$', login_required(views.LinkListView.as_view()), name='links') and view: class LinkListView(ListView): model = Link template_name = "app/links.html" in html: href = "{% url 'links'%}" I get an error NoReverseMatch I have already googled that ...
    Django Anonymous, Aug 30, 2020

  • 0answers
    Where can I find Django developers?
    Hello Please advise where can I find a team or company that can make applications in Python \ Django? The language of communication is Russian or English. Especially those who know how to integrate such applications and work with APIs of other applications. Perhaps you can advise someone, have ...
    Django Anonymous, Nov 21, 2020

  • 0answers
    What Django application exists for dealing with sessions and HTTP Referers?
    Good time of the day! Recommend a Django application to implement a mechanism for returning to pages from which there was a transition. Those. for example: a user entered a page with a form, filled out the form crookedly, it came back, filled out the form correctly and came back. At a primitive ...
    Django Hunter McKee, Jan 25, 2020

  • 0answers
    How do I create invoices?
    Good day! there is a project on django 1.7, the customer suddenly wanted to generate invoices for clients, I think so, take an invoice form in pdf and add details and amounts to it, what libraries do you recommend? Or can you recommend a different solution?
    Django Mason Bennett, Jul 6, 2020

  • 0answers
    UWSGI configuration: processes, workers and threads. What's a good configuration for a weak server?
    Hello everyone, I recently launched a project on vdsk (1 core, 512 mb memory, SDD disk) under Ubuntu. I started testing the site and noticed that with a load of 15 concurrent users, the processor is loaded at 100%. Revised everything that I set up and configured. It seems that the weakest link in ...
    Django Anonymous, Apr 13, 2020

  • 0answers
    How do I properly cache an object (not a model) in Django?
    Good afternoon! There is a PaymentChecker class, its creation takes quite a long time, and it is not profitable to create it in each request, since it does not change from request to request, that is, you need something like a singleton. Therefore, the actual question is how to cache it ...
    Django Anonymous, Dec 27, 2019

  • 0answers
    Static paths broken when deploying django?
    When deploying the site on the server, paths to static files broke, tried reading the wsgi documentation, deploying statics, collectstatic, but did not understand anything, can someone explain more popularly? Jino hosting
    Django Thomas Walker, Jul 15, 2020

  • 0answers
    Images in django in production?
    Everything stopped when I installed it. Debug = False Static works fine after collectstatic In a browser. & lt; img src = "/ media / media / 1.jpg" & gt; Settings.py STATIC_URL = '/static/'MEDIA_URL = '/media/'MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media')CKEDITOR_UPLOAD_PATH = ...
    Django James Powell, Mar 26, 2019

  • 0answers
    How to send out a 100k base?
    Good day, everyone. The situation is this: there is a base of 100k subscribers (subscribers are legal, collected over a long time). How to organize mailing to this database? There is a server and a django application for mailing. But how much will it work? What is the percentage of spam emails? ...
    Django Anonymous, Jun 21, 2019