I am using django with postgreSQL to make a book library website. I have three models below, they were all simplified for the showcase:
class Tag(models.Model):
TagName = models.CharField(verbose_name='Tag name',max_length=128)
class Author(models.Model):
AuthorName = models.CharField(verbose_name='Author name',max_length=128)
class Book(models.Model):
BookName = models.CharField(verbose_name='Book name',max_length=128)
TagName = models.ForeignKey(Tag, on_delete=models.CASCADE, verbose_name='Tag Name')
AuthorName = models.ForeignKey(Author, on_delete=models.CASCADE, verbose_name='Author Name')
Now with data ready and connected with each other, I was trying to use the postgreSQL Schema Views to make a booklist, which I wanted to be shown like this:
SEARCHVIEW
/TagName /AuthorName /BookName
Recipes Jeff Chef Jeff's food
Recipes Jeff Foods in Europe
Stories Jeff an Adventure Story
I was trying to use the PostgreSQL's query tool to generate the views for me, but I found a hard time trying that, even though I did a lot of research it still got something wrong.
May I ask for my instance above, how can I create this view by using the query tool of PostgreSQL? Thank you!