Model

class saloon(...) ... saloon_name = models.CharField(...) ... 

and 2nd

 class saloon_like(...) ... saloon_likes = models.ForeignKey(saloon) ... 

for display in the admin is not 'saloon_object', but the name in the model I write:

 def __str__(self): return self. ***А ЧТО ЗДЕСЬ?*** 

self.saloon_likes__saloon_name does not fit

    1 answer 1

     def __str__(self): return self.saloon_likes.saloon_name 

    If the relationship is one-to-one or many-to-one, then we go up using dotted notation. The current field that is listed as the glue will represent the “top” model.

    If you need one_something:

     saloon = Saloon() saloon_like = Saloon_like(saloon_likes=saloon) saloon_like2 = Saloon_like(saloon_likes=saloon) all_likes = saloon.saloon_like_set.all()