Questions tagged as 'django'

2
answers

'PostListView' object has no attribute 'views'

What I want to do is that an entry has a visit counter but I can not implement it correctly. models.py class Post(models.Model): title = models.CharField(max_length=50) content = models.TextField() author = models.ForeignKey(U...
asked by 12.12.2018 / 00:02
1
answer

Error importing a model Unhandled exception - can not import name

I have the following structure of my application in relation to the following apps project userprofile models.py rbsessions models.py In userprofile / models.py I have the following from __future__ import unicode_l...
asked by 20.01.2016 / 15:58
1
answer

Edit form fields in Django to modify the input object

I need to validate a form, but Foundation Abide PlugIn works by selecting the input fields that have the required tag added: <input type="text" placeholder="1234" aria-describedby="exampleHelpText" required pattern="number">...
asked by 15.02.2016 / 02:11
1
answer

Error with the Django runserver command

Trying to run the local Django server I get the following error in the terminal when running using runserver . This is the code: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_comman...
asked by 11.02.2016 / 04:27
1
answer

Pylint - Too many boolean expressions in if statement

Good afternoon I have the following code snippet: content_view = cleaned_data.get('content_view') show_content = cleaned_data.get('show_content') show_children = cleaned_data.get('show_children') footer_title_1 = cleaned_data.get('footer_titl...
asked by 03.05.2016 / 00:13
1
answer

Restart .exe .bat processes in python or django

I wonder: is it possible to restart .exe .bat processes in python or django language? Basically they are running processes in production on remote servers. What is needed is to automate the process by avoiding entering each of them and restar...
asked by 04.04.2016 / 18:52
1
answer

Would you return an argument where you should return two in django's views?

Good afternoon dear stackoverflow friends I have this doubt, I'm trying to print pdfs from django with the xhtml2pdf library for my projects in django2.0 , I follow a tutorial that I find interesting that the source is: link My error on...
asked by 02.06.2018 / 05:23
2
answers

"NoReverseMatch at" error with "django.contrib.auth.views.login" tests

I would like to authenticate users using django.contrib.auth.views.login . I want that when the login is correct I send them to dashboard . I have the following codes: In settings: LOGIN_REDIRECT_URL = '/usuarios/dashboard/'...
asked by 19.01.2016 / 13:06
1
answer

Regular expression for django url with slug containing "/"

The idea is to create a regular expression to configure the url I have 2 models, category and articles. The article model has a FK to category and the slug makes the join correctly slug (category) / slug (article). I want to use the separator...
asked by 23.08.2017 / 05:13
1
answer

Pass a unit test of views based on Django classes

I'm adding unit tests to my blog and I can not pass the test that should happen . The test is this: from django.test import TestCase from django.urls import resolve from apps.blog.views import EntryList class ApiRootTest(TestCase): de...
asked by 06.08.2017 / 00:46