Answer the question
In order to leave comments, you need to log in
Django, how to display a button to automatically write to a table?
Hello, I'm new to Django, I need help on how to display a button next to each ClientAdmin list_display line that automatically writes data to the Jurnal table, i.e. for example, a client came > clicked the button > and for this client they signed up in the Jurnal table
, there are models
class Client(models.Model):
client_id = models.AutoField(primary_key=True)
client_name = models.CharField(max_length=30, blank=True, null=True)
client_familia = models.CharField(max_length=30, blank=True, null=True)
pol = models.CharField(max_length=1, choices=POL)
class Jurnal(models.Model):
poseshenie = models.AutoField(unique=True, primary_key=True)
client = models.ForeignKey(Client, models.DO_NOTHING, blank=True, null=True)
data_poseshenia = models.DateField(blank=True, null=True)
time_poseshenia = models.TimeField(blank=True, null=True)
class ClientAdmin(admin.ModelAdmin):
class ClientAdmin(admin.ModelAdmin):
list_display = ('client_id', 'client_name', 'client_familia', 'time_poseshenia', 'button')
def button (self, obj)
....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question