Questions tagged as 'django'

2
answers

Deleted Files Django Migrations

I'm having a constant problem. As I'm working with several branches in a project, sometimes I go back in an old branch, I bring branch updated to old so I do not have to be creating old bank migration. So every time of the problem with migration...
asked by 29.06.2017 / 23:22
2
answers

Python calling super () on a class that does not implement inheritance

I'm developing some middlewares and delving into the Django source code I came across the following: class MiddlewareMixin: def __init__(self, get_response=None): self.get_response = get_response super().__init__() de...
asked by 05.08.2018 / 21:16
2
answers

Django + Python update and not insert

I'm using a filter to return some student and update their data, however when I try to save I get the following error:    Student with this CPF already exists and Student with this RA already exists. My views.py : from django.s...
asked by 03.09.2018 / 16:34
0
answers

Could not parse the remainder: '[1]' from 'i [1]' in Django

I'm trying to do a check to modify the bootstrap component according to the status id, but it returns me this error:    Could not parse the remainder: '[1]' from 'i [1]' in Django The error code snippet is as follows: {%for i in cli %}...
asked by 08.01.2015 / 13:01
2
answers

Generate querysets from dynamically generated rules

I'd like to do a sort of filter using Django. Imagine the following case: Model: user (Name, gender, age, natal_day, birth_ month, etc.) Rule: Catch all users with Gender = M and Age > 20 The intent would be to generate rules fro...
asked by 14.05.2018 / 20:01
1
answer

Saving past data - Django

My question is as follows, in my application I have a Profile template that has the following fields: Models.py: class Perfil(models.Model): nome = models.CharField(max_length=255, null=False) pontuacao_total = models.FloatField(max...
asked by 02.04.2018 / 00:49
1
answer

background-image: url (with a URL that has parentheses with Django template

I have a div like this: <div style='background-image: url({{ OBJETO.URL }})' class="video-thumb"></div> Where Objeto.url delivers a string like this: http://dominio/rota/id/original/(nome)8.jpg When rendering the HTM...
asked by 11.12.2016 / 19:48
1
answer

Show list items by filtering by date.today ()

I have a list that I sort by position in my models.py , however I have the start_date field that I want to use as a validator for the item to be visible or not. But it is not working: views.py : from django.shortcuts...
asked by 27.09.2018 / 20:32
1
answer

Django session, issue: Object of type '' is not JSON serializable

I am creating a student but when I try to save it inside a session, it returns the following error: Object of type 'Student' is not JSON serializable No settings.py: INSTALLED_APPS = [ 'django.contrib.admin', 'django....
asked by 21.08.2018 / 20:36
2
answers

How to make link to file download in html?

I'm using the tag: <a href:"{{ arquivo.caminho }}" download>link</a> With the download attribute to download links from my local network files (tiff images), however, the downloaded file is a .tiff file containing the html of my...
asked by 30.01.2018 / 19:56