Questions tagged as 'django'

1
answer

ID Alfanumerico Django

good: I'm trying to generate unique ID's with letters and numbers but all the methods I've tried return strings that can give the possibility of repeating and cause the application to fail. Right now I have this: class Comentario(models.Mod...
asked by 26.01.2018 / 16:06
1
answer

If statement does not execute as I expected in Django

I have the following function: def destroy(self, request, *args, **kwargs): id_act = kwargs.get('pk', None) userObject = User.objects.get(pk=self.request.user.pk) try: ocurrencia = Ocurrencia.objects.get(pk=id_act)...
asked by 17.11.2017 / 16:29
1
answer

Add various details to a sale Django

I have 2 apps client and sale where the client has only one client table class Cliente(models.Model): nombre = models.CharField(max_length=100, verbose_name='Nombres') and sale has 2 tables (Sale and retail detail) and product but t...
asked by 25.01.2018 / 22:49
1
answer

How to change re address by default of login_required in Django?

I am using the login_required decorator to not allow the login without authenticating but I would like that when you enter a link without logging in, I redirect you to a specific page and not the default one that is account / login link     
asked by 29.10.2017 / 01:58
1
answer

Empty Label for a field with ModelChoiceField

Hello, I have a form (in django 1.8) with a field that uses a ModelChoicefield class MyForm(forms.Form): ... campoA = forms.ModelChoiceField( queryset=ModeloB.objects.values_list('campoA__name', flat=True).distinct(), l...
asked by 18.10.2017 / 20:52
1
answer

Import an xls or csv without Django model

I have been researching and can not find a way to import a file either xls or csv without having a model, I am trying to import files of this type into the database but they could vary in number of columns unexpectedly there is way...
asked by 15.08.2017 / 13:12
1
answer

Avoid repeated objects in the django database

I have a page that has a form where people can put a name, and create a profile. The problem is when several people try to put the same name, since it gives this error get() returned more than one Person What I'm trying to do is to avo...
asked by 04.08.2017 / 21:06
1
answer

Add reddit / hacker news style votes in Class Based Views

I would like to add something similar to the voting system that many web pages have like StackOverflow, Reddit, Hacker News, etc. I wanted to create a button to do this task in the main template that I have, trying to create a FormView bu...
asked by 06.09.2017 / 21:39
1
answer

Problem with inheritance in Django models

In my Django application I am working with calendars. For my purposes I have to use the classes Event and Occurrence of the module Django-Scheduler but adding new fields. I would like to know how to inherit from those classes to bu...
asked by 16.06.2017 / 19:08
1
answer

Display values ManyToMany in DJango

You see, in my project I need to use manytomany variables to store foreign keys that point to several values. Code on models.py: class desplazamiento(models.Model): nombre=models.CharField(max_length=15) descripcion=RichTextField(ma...
asked by 23.05.2017 / 18:13