Questions tagged as 'django'

1
answer

Return only the name of the file in the view

How do I display only the file name, example RET_PREF_ANAPOLIS ..., removing the path arquivos/ ? models.py:defuser_directory_path(instance,filename):ifinstance.tipo_arquivo.id==1:tipo='RET'elifinstance.tipo_arquivo.id==2:tipo='REM'filena...
asked by 16.12.2018 / 22:30
1
answer

pylint E1101: Class 'User' has no 'objects' member

I am using vscode together with DjangoRestFramework and the same is accusing error in the following line: res = User.objects.filter(user_nome=value) But the code runs correctly, the error that the editor shows is as follows: pylint E1101:...
asked by 18.07.2018 / 16:02
1
answer

Django. Only change in bank via html

I've been developing in Django for a short time, I have a nice image on my site, when I click on it I would like to only change a field in the database without reloading or resending the page and stay in the same place. I have a question abo...
asked by 29.08.2018 / 14:40
1
answer

Creating Table / BD with Django?

I use python 3.4 and the latest version of django, I am using the "python manage.py sqall" command but it does not recognize the sqall command. (I am trying to create a table in Bd, and already enter the data correctly.)     
asked by 21.06.2018 / 19:12
1
answer

Django: how to use forms.ValidationError and display messages in the template

I would like to inform the user (in the html template) of a message when identifying an existing email in the registration page. In forms.py I use the clean_email function to check if there is an email already registered. After checking for...
asked by 26.06.2018 / 18:11
1
answer

What is the correct way to do the template in Django / python?

This has been my first contact with the framework and with mvc / mvt, and I am in doubt, in terms of good practices and tals, should I make a template for each of the views or should I just make a template and change the template content dynamic...
asked by 16.03.2018 / 18:14
1
answer

How to add methods to a QuerySet?

I have a model defined in Django. I would like to add to this model a method that returns me part of a mounted query (a QuerySet ). That is, a method I want to define a method that affects the results of the query when calling Model.objects...
asked by 09.02.2018 / 13:15
1
answer

How to call an attribute of the class in another class in django

I'm trying to create some classes that will relate in a way. The idea is to be a game in which the player will have some options of choice and then his score is based on the punctuation of his choices (rather than a fantasy game). For example...
asked by 28.01.2018 / 17:35
1
answer

Django Models with default value in another branch

I'm having a field that I've added to another branch (which is in developing status ) calling money , with default value: 0.00 in the User model. However, it is not yet being used in the production branch. Today when I we...
asked by 08.01.2018 / 20:00
1
answer

Working with Data in ngInit

I have an input on my date form. Whenever the user modifies the date, it will be updated in Django and will return another date. When the user enters the screen, I already bring the date as follows: 1996-10-01 Input <input ty...
asked by 31.10.2017 / 16:27