Django answers

  • 0answers
    How do I display related objects in a separate ListView?
    Good afternoon! I can't figure out how to do it correctly. Let's say we have the following models: class Post(models.Model): ...class Comment(models.Model): ... post = models.ForeignKey(Post) To display the list of posts, use: class PostListView(ListView): model = ...
    Django Anonymous, Jul 19, 2019

  • 0answers
    Deploy a project from github to pythonanywhere?
    Who did, please give me the most detailed guide. I would be grateful. summon Sim3x. p.s Share skype, vk?
    Django Anonymous, Feb 22, 2020

  • 0answers
    How to output defaultdict element by element in Django template?
    We have the following code: from collections import defaultdictfoo = defaultdict(dict)foo[1][1] = 12foo[1][2] = 24foo[2][1] = 36foo[2][2] = 48foo[3]['string'] = 'foo bar'print foo[2][1]print foo[3]['string'] Prints output whatever is needed (48 and 'foo bar'). Now I would ...
    Django Anonymous, Feb 27, 2020

  • 0answers
    & quot; no module named setuptools & quot; when installing Django, what to do?
    Original: Python 2.7.10 (latest from site) and Django not installed When you try to put everything, the following comes out: I no longer understand what to do. It's not the first hour I've been fighting. Setuptools seems to be in the python library
    Django Anonymous, Jun 4, 2020

  • 0answers
    How to create a django project for win10?
    Hello! Faced the following problem on win10, I give the order of actions point by point: 1) Install python from the official site 2) Trying to create a virtual environment virtualenv django The error is returned: Fatal error in launcher: Job information querying failed 3) Google and ...
    Django Anonymous, Apr 4, 2020

  • 0answers
    How do I enable the display of JavaScript code structure in the File Structure window for HTML documents (Django framework templates)?
    I have a Django HTML Template with a lot of JavaScript in the script tag (know it's bad practice). In the "File Structure" window, I do not see the JavaScript structure, although I would very much like to, because I am used to navigating Ctrl + R in sublime, and in PyCharm this is done by ...
    Django Kaleb Carroll, Dec 10, 2019

  • 0answers
    Which tool to choose for developing an online store?
    Good afternoon! Has anyone come across developing an online store using python / Django? What are the ready-made solutions in this area and which are best suited for this task? As far as I understand, things are much worse for python in this area than for php or even ror ...
    Django Alexander Cruz, Apr 17, 2019

  • 0answers
    Django view primarykey how to get data from the base as in the example?
    It must be brought to mind. There is an approximate solution, but it does not display correctly. Namepart1: racdel1 racdel2: podrazdel1 podrazdel2 podrazdel3 Namepart2: razdel3: podrazdel4 podrazdel5 razdel4 razdetl5 and so on. class NamePart(models.Model): title = ...
    Django Lorelei Waters, Nov 1, 2020

  • 0answers
    CkEditor Django changing library?
    How to add attribute when adding an image? So I add an image and with pens in the source (in the form itself) I need to add the code class = "img-responisve" d de find so that when adding an image it does not write < code class = "html"> & lt; img src = "folder / asdasd.png" & gt; and wrote ...
    Django Anonymous, Dec 8, 2019

  • 0answers
    Django view primarykey how to get data from the base as in the example?
    It must be brought to mind. Namepart1: racdel1 racdel2 Namepart2: razdel3 razdel4 razdetl5 and so on. I know that there are two cycles and you have to shaman with a view, but how? class NamePart(models.Model): title = models.CharField(max_length=255,verbose_name=" .") def ...
    Django Anonymous, Jul 4, 2019

  • 0answers
    How do I force uwsgi to free memory?
    I noticed that the uwsgi processes are gaining and gaining megabytes over time. How to make them dump extra megabytes automatically, for example, after inactivity for 1 minute.
    Django Anonymous, Jun 22, 2020

  • 0answers
    Redirect after logout django?
    I use django allauth, after the logout you need to either change the page, or redirect to the main page. http://127.0.0.1:8000/accounts/logout/
    Django Anonymous, Nov 27, 2019

  • 0answers
    How do I update the Django version?
    Hello, I currently have Django 1.7, but I want to upgrade to 1.8. The easiest way to do this? My OS: OS X Yosemite
    Django Anonymous, Nov 4, 2019

  • 0answers
    How do I make a compound field in Django?
    Hello everyone, there is a model with a fio field, you need to create a form and divide this field into 3 parts, that is, into the fields of first name, last name and patronymic. How can I do that?
    Django Declan Salinas, Sep 6, 2019

  • 0answers
    How do I automatically increment a value in a form?
    Good afternoon, I shoveled through all the documentation, tried many methods, but I still can&#39;t get the desired result. There is a form that is bound to the User model. The User model has a "term" attribute that must be incremented by 1 each time the submission is clicked. Here&#39;s what I ...
    Django Anonymous, Oct 13, 2019

  • 0answers
    How do I add images in Django to articles?
    Hello. When I add an article to the site through the django admin, I also need to add a picture to it. How to do it? And how to make it appear on the page with the article. As far as I know, ImageField is used for this, but it&#39;s not so simple there. Could you give an example of how to ...
    Django Anonymous, Dec 11, 2020

  • 0answers
    How to serialize correctly in Django or render in JS?
    Good day. Trying to serialize form.error.items () in the view and handle it with js: if user_form.is_valid():\\....else: data = dict([(k, [e for e in v]) for k,v in user_form.errors.items()]) return JsonResponse(data) When I process on the client side, I get a problem. json is not ...
    Django Evangeline Gardner, Jan 6, 2019

  • 0answers
    Localhost and VKontakte authorization?
    I use django-allauth. I get in response. {"error":"invalid_request","error_description":"redirect_uri has wrong domain, check application settings"}
    Django Greyson McIntyre, Aug 4, 2019

  • 0answers
    Django allauth authorization not working?
    I installed everything according to the documents, added two app, facebook and vk in the admin panel. But in the transition, : 8000 / accounts / login, there are no links for authorization using neither the first nor the second. Applications registered at localhost tutorial ...
    Django Anonymous, Dec 24, 2019

  • 0answers
    How to properly package Python applications in a DEB package?
    I am developing another project, there is an opportunity to creatively realize myself. I decided to fully configure the environment and deploy. The project itself is written in Django (1.8, python 3.4). I use Ansible to set up the environment and deploy, but what I don&#39;t like is installing ...
    Django Emmett Douglas, Jul 6, 2019