Django вопрос про админку

Discussion in 'PHP' started by ^NSA^, 15 Sep 2014.

  1. ^NSA^

    ^NSA^ Elder - Старейшина

    Joined:
    3 Jul 2012
    Messages:
    69
    Likes Received:
    29
    Reputations:
    32
    Code:
    class Page(models.Model):
        title=models.CharField(max_length=150)
        topic = models.TextField()
        category_id = models.ForeignKey(Category)
        img_url =models.URLField()
        hide =models.BooleanField(default=True)
        url = models.URLField()
        pub_date = models.DateTimeField('date published')
    
    
    модели связаны

    вопрос как в админки вывести название самой категории


    admin.py

    Code:
    class BlogAdminPage(admin.ModelAdmin):
        
        list_display =('title','topic',)
        list_filter = ['pub_date']
        search_fields = ['title']
    [​IMG]

    --------------------------------------------------------------------------
    нашел решение
    HTML:
    def __unicode__(self):
            return self.title_category
    
    
     
    #1 ^NSA^, 15 Sep 2014
    Last edited: 15 Sep 2014
Loading...
Similar Threads - Django вопрос админку
  1. bazilisk99
    Replies:
    1
    Views:
    2,190
  2. ^NSA^
    Replies:
    0
    Views:
    1,018
  3. ^NSA^
    Replies:
    0
    Views:
    978
  4. [XTR]
    Replies:
    3
    Views:
    1,494