python - How to get exactly models field after I filtered the models object? -
It's hard to describe what I have to do, but I will try to do this after filing such a model ( I can only get a maximum of 1 object):
tweets = tweet.object.filter (user__iexact = username) # username found with variable url I want to show that which user tweeted. So I'm trying to do this in my template like this:
& lt; H1 & gt; {{tweets.username}} & lt; / H1> However, it is not showing anything, however, these are my models:
class tweets (model model): text = model. Kharefild (maximum_long = 140) date = model.defined (default = date.) User name = Model.CharField (max_length = 140)
If you are asking for a unique entry, then . Tweets = Tweets.bobsSites.Jet (Username_Xact = Username) .filter . The
filter () method will return an array, even if it is only a result. Furthermore, your query is incorrect ... You have username user (user Name = xxact = username)
Comments
Post a Comment