Multilevel display for a model in Django admin

9 views
Skip to first unread message

Sahana Prabhakar

unread,
Aug 16, 2017, 9:08:50 AM8/16/17
to Django users

I have a model as follows :


    


    class Transaction(models.Model):
    transaction_id = models.AutoField(primary_key=True)
    transaction_unique_id = models.CharField(max_length=100, null=True, blank=True, unique=True)
    route_id = models.ForeignKey(FlightScheduleDetail, null=False, blank=False)
    flight_number = models.ForeignKey(FlightNumbers, null=False, blank=False)
    device_id = models.ForeignKey(DeviceInfo)
    crew_code = models.ForeignKey(Crew)
    time_of_transaction = models.TimeField()
    total_quantity = models.IntegerField()
    manually_added_flag = models.BooleanField(default=False)
    seat_number = models.CharField(max_length=200, null=True, blank=True)
    transaction_type = models.CharField(max_length=200)
    reason_code_id = models.ForeignKey(ReasonCode, null=True, blank=True)
    total_amount = models.FloatField()
    amount_by_card = models.FloatField(null=True, blank=True)
    payment_mode_id = models.ForeignKey(PaymentMethod, null=True, blank=True)
    transaction_date = models.DateField(null=True, blank=True)
    created_at = models.DateTimeField(null=True, blank=True)

    def __unicode__(self):
        return u'%s' % self.transaction_unique_id

    class Meta:
        verbose_name_plural = "Post Flight Transaction"



In my admin, I need a customization which displays all the route_id values from the model and when I click on one route_id , it displays all the transaction_date values and under them, it displays all the transaction_id values and when I click on one entry , in this level, I need to display its edit screen. Basically I need a folder like implementation for a model. I need to group and display all the entries. I googled for the same, but could not find any solution. Is this even possible in django? Please help.


Reply all
Reply to author
Forward
0 new messages