I have a Task
model in Django which looks like the following:
class Task(TimeStampedModel):
project = models.ForeignKey(Project, related_name='tasks')
date = models.DateField(_('date'))
task = models.TextField(_('what\'s the task?'))
status = models.CharField(
_('what\'s the status'), default=constants.TASK_STATUS_EMPTY,
max_length=40, choices=constants.TASK_STATUS_CHOICES)
status_note = models.TextField(_('write a note about status'), blank=True)
created_by = models.ForeignKey(User, related_name='created_tasks')
modified_by = models.ForeignKey(User, related_name='modified_tasks')
class Meta:
ordering = ('-created', '-modified')
def __unicode__(self):
return self.task
Here is a screenshot of the final implementation:
I have exposed this Task
model using django-tastypie
as a RESTful api.
On client side, I have used AngularJS for editing/adding tasks.
I need to group tasks by project and date for rendering them properly. I have used _.groupBy method of lodash.js for this.
I wanted to know if there is a better approach to implement same interface.
django-tastypie
may be a pain. Further, API could have been complicated if I moved this to server side. Lodash has reasonable performance. Anyway, as per our use case, no. of tasks to be rendered on a page will be always less than 2000. \$\endgroup\$