I am using python to get values from one of table using filter .
queryset1 = model_user_profile.UserProfile.filter(user = uid).values('time_zone')
where model_user_table has following columns:
---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(11) | NO | UNI | NULL | |
| time_zone | varchar(128) | YES | | NULL | |
+---------------+--------------+------+-----+---------+----------------+
value of uid and user_id in above query and table respectively are 1 and 1 , but still query fails and error: AttributeError: type object 'UserProfile' has no attribute 'filter' is displayed.
I am using similar queries in past but never received such error , what can be the possible issue????
use this:
filter is like where clause in sql
obj = your_model.objects.filter( user = uid)
for more info see this docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With