Questions tagged as 'django'

1
answer

Edit django widgets

Hello! I'm developing a Django application. On the project registration page there is a SelectMultiple pro user to select the participating teachers. But on the details page I just wanted to see the names of the teachers who were selected in the...
asked by 16.03.2016 / 16:16
2
answers

What is the difference between forms.Form and forms.ModelForm?

Hello, dear. With the help of a tutorial, I was able to create a template with form and use the forms.ModelForm to save in the database, however, I saw in the Django documentation that there is also the forms.Form. What's the difference? D...
asked by 03.01.2016 / 21:38
2
answers

How to allow a DecimalField field with the currency format BR in Django?

I have the following class: class Carro(models.Model): valor = models.DecimalField(max_digits=8, decimal_places=2, default=0) And their respective form: class CarroForm(forms.ModelForm): class Meta(): model = Carro...
asked by 03.04.2015 / 19:01
1
answer

Django - How to distinguish which button was clicked?

In the search template of my application I have 3 <button> tags, one to search, the other to edit and one to delete: <button class="btn btn-lg btn-primary" type="submit" id="buscar" name="buscar">Buscar</button> <button c...
asked by 27.05.2014 / 20:01
1
answer

Use tuple with parentheses in query in django

I made a cursor to get the parent menus of my application, then I want to iterate each parent menu and get the menus associated with it. However, passing parent with parameter, the second course does not work. from django.db import connection...
asked by 01.07.2018 / 00:24
1
answer

MySQL Connector for Python 3

I'm doing a project with Django and Python 3 but I can not find the appropriate MySQL connector. django.db.backends.mysql works, but only for Python 2, and I wanted to avoid using that version. In the terminal when I type import djang...
asked by 12.03.2015 / 20:37
1
answer

How to call the previous select id

I have 2 selects, one division and the other group. When the division is selected it has to bring in the second only the groups that are part of that division. In the url variable that takes json I called python according to my view, but instead...
asked by 13.09.2017 / 16:17
2
answers

Filter with first item from a ManyToMany Django

I have this in my template: {% for j in jobs %} <tbody> {% if j.background.all.0.active == False %} ... I need to make a filter in the view similar to this. I tried jobs = jobs.filter(background__first__active...
asked by 20.08.2016 / 18:46
1
answer

Returning the minimum value for comparison in template Django

Following up on an answer at link def quotation_list(request): stores = list(Store.objects.all()) products = list(Product.objects.all()) # indice index_store = {store.id: index for index, store in enumerate(stores)} index...
asked by 05.12.2015 / 04:24
2
answers

Doubt with Python + django

I'm starting with Python and Django, following a tutorial I found: link When I run the django-admin command with startproject, it does not generate that folder structure it shows in the tutorial, it just creates a file that opens dir...
asked by 17.06.2016 / 18:47