class courses(models.Model):
level = (
('beginner', 'Beginner Level'),
('intermediate', 'Intermediate Level'),
('expert', 'Expert Level'),
('all level', 'All Level'),
)
type = (
('live', 'LIVE'),
('on demand', 'On Demand'),
)
ins_id = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
coursetype = models.CharField(max_length=50,choices=type, default="on demand")
cid = models.UUIDField(default=uuid.uuid4, editable=True, primary_key=True)# course id
course_title = models.CharField(max_length=255, default="")
course_sub_title = models.CharField(max_length=255,default="")
course_level = models.CharField(max_length=255, choices= level, default="beginner")
course_main_cat = models.ForeignKey(courses_main_categories, on_delete=models.CASCADE)
course_sub_cat = models.ForeignKey(courses_sub_categories, on_delete=models.CASCADE)
course_permalink = models.SlugField(max_length=255,default="")
image_path = models.ImageField(upload_to="media",blank=True,default="")
is_published = models.BooleanField(default=False)
is_in_draft = models.BooleanField(default=True)
a_pending = models.BooleanField(default=False)
i_pending = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
live_course_start = models.DateTimeField(auto_now_add=True)
live_course_end = models.DateTimeField(auto_now_add=True)
course_desc = models.CharField(max_length=255, default="")
primarily_taught = models.CharField(max_length=255, default="")
class course_review_report(models.Model):
task_id = models.BigAutoField(primary_key = True)
expert_id = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
cid = models.ForeignKey(courses,on_delete = models.CASCADE)
is_completed = models.BooleanField(default=False)
is_pending = models.BooleanField(default=True)
assigned_date = models.DateTimeField(auto_now_add = True)
review_completion_date = models.DateTimeField(auto_now_add = True)
This is my project models
I want to get those cid from courses tables which have the is_published = True and based on this I want to get the course_review_report data on the basis of distinct cid.
Can anyone write the querryset for the same..
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPjsHcHWGKqn82oEz-So%3DKcoT3HKjD5DnHc86d4koBOGxXQnsA%40mail.gmail.com.
No comments:
Post a Comment