Questions tagged as 'django-models'

0
answers

Django: delete a record from my table in one view and add the record in another table

I'm doing an inventory application for my workshop. I have a view that generates a tool cart, in the cart the employee assigned to the cart is assigned, the tools it contains and the quantity of each of them. What I intend to do is the following...
asked by 20.07.2018 / 23:28
1
answer

Django ManyToManyFiled how to add 2 objects of the same type to a model

I'm doing an inventory of tools, and I want to have a way to create a tool cart where I can add repeated tools. Example (Add to the cart two cutters of the same type). I have a table called Item This table contains all the common fields of...
asked by 17.07.2018 / 23:26
1
answer

Store the id of the object in a manytomany field

I have a user model in django with a field: wallets = models.ManyToManyField(Wallet) and a Wallet object with other fields. I currently store the names of the Wallets objects assigned to the user in the user's wallets field. How can I store...
asked by 15.07.2018 / 15:26
0
answers

Data entry form with Django

Someone can help me, I have the following model: class Citas2(models.Model): laboratorio = models.CharField(max_length=10, default=LABORATORIO_1, null=True) paciente = models.ForeignKey(Pacientes, on_delete=models.CASCADE) doctor =...
asked by 12.07.2018 / 19:20
1
answer

Queryset with 2 fields of a table - Django Rest Framework

I want to make a filter with 2 fields of the user model of django first_name and last_name In this way: queryset = User.objects.annotate(search_name=Concat('first_name', Value(' '), 'last_name')) queryset.filter(search_name__icontains='Pru...
asked by 30.06.2018 / 19:23
0
answers

How can I use Form Wizard in Model Forms with django?

I want in the same template to capture 3 different forms through a step by step (steps). I did it initially with dividing the forms to capture, but I keep losing info of the first, or second step ... I was looking at something from Form Wizard i...
asked by 15.06.2018 / 16:31
0
answers

Capture a select value in a view of django

I do not know how to capture the value of a select from a form created from a ModelForm. in the template: <div class="form-group"> <label for="{{formulario.cod_sucursal.id_for_label}}"> {{formulario.cod_sucursal.label}}</labe...
asked by 05.06.2018 / 22:06
0
answers

Filter values of a field from a list [...] - Query Django

class Grupos(models.Model): grupo = models.CharField(max_length=300) familia =models.CharField(max_length=300) fg = models.CharField(max_length=300) status=models.IntegerField(defaul...
asked by 27.05.2018 / 05:27
2
answers

How can I iterate the following data dictionary in Django

I have the following models in python: class ModuleType(models.Model): name = models.CharField(max_length=150, unique=True) icon = models.CharField(max_length=100, unique=True) state = models.IntegerField(choices=state_choices, def...
asked by 24.04.2018 / 23:56
1
answer

Django ModelForm filter according to another field

I am trying to make the drop-down list of a field change according to what you have selected in another field, in my case it changes the state according to the selected municipality, that is to say that only the states corresponding to that muni...
asked by 04.05.2018 / 16:58