serializers.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
  2. # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
  3. # Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as
  6. # published by the Free Software Foundation, either version 3 of the
  7. # License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. from taiga.projects.issues.serializers import IssueSerializer
  17. from taiga.projects.userstories.serializers import UserStorySerializer
  18. from taiga.projects.tasks.serializers import TaskSerializer
  19. from taiga.projects.wiki.serializers import WikiPageSerializer
  20. from taiga.projects.issues.models import Issue
  21. from taiga.projects.userstories.models import UserStory
  22. from taiga.projects.tasks.models import Task
  23. from taiga.projects.wiki.models import WikiPage
  24. class IssueSearchResultsSerializer(IssueSerializer):
  25. class Meta:
  26. model = Issue
  27. fields = ('id', 'ref', 'subject', 'status', 'assigned_to')
  28. class TaskSearchResultsSerializer(TaskSerializer):
  29. class Meta:
  30. model = Task
  31. fields = ('id', 'ref', 'subject', 'status', 'assigned_to')
  32. class UserStorySearchResultsSerializer(UserStorySerializer):
  33. class Meta:
  34. model = UserStory
  35. fields = ('id', 'ref', 'subject', 'status', 'total_points')
  36. class WikiPageSearchResultsSerializer(WikiPageSerializer):
  37. class Meta:
  38. model = WikiPage
  39. fields = ('id', 'slug')