Hi everyone !
I’m currently learning Django and how to play with the Django’s API for managing SQL entries.
Thus, I don’t know how to get a SQL entry via its name.
Indeed, in the following example, I create a “Forum” model :
class Forum(models.Model):
forum_name = models.CharField(max_length=20)
forum_description = models.CharField(max_length=100)
This model has two fields, forum_name and forum_description.
I’ve successfully created Forum objects/entries inside my app through the shell but, how can I make a SQL query via the “forum_name” attribute like
"SELECT the entry FROM TABLE “Forum” that has the FIELD “forum_name” equals to “something” " ?
I’ve tried :
Forum.objects.get(forum_name="something")
But the shell won’t accept this query…
How can I fix this issue ?
Thank you in advance for your help