Test coverage report: subscribe.models

# subscribe.models: 14 total statements, 100.0% covered

Generated: Sat 2013-04-06 17:51 SGT

Source file: /Users/martin/Repos/django-subscribe/subscribe/models.py

Stats: 8 executed, 0 missed, 6 excluded, 27 ignored

1. `"""Models for the ``subscribe`` app."""`
2. `from django.contrib.contenttypes import generic`
3. `from django.contrib.contenttypes.models import ContentType`
4. `from django.db import models`
5. `from django.utils.translation import ugettext_lazy as _`
6. ``
7. ``
8. `class Subscription(models.Model):`
9. `"""`
10. `Allows a ``User`` to subscribe to anything.`
11. ``
12. `:user: The ``User`` who subscribed to something.`
13. `:content_object: Generic foreign key to the thing that the user is`
14. `subscribed to.`
15. `:date: Date when the subscription was created.`
16. ``
17. `"""`
18. `class Meta:`
19. `unique_together = ('user', 'content_type', 'object_id', )`
20. ``
21. `user = models.ForeignKey(`
22. `'auth.User',`
23. `verbose_name=_('User'),`
24. `related_name='subscriptions',`
25. `)`
26. ``
27. `content_type = models.ForeignKey(`
28. `ContentType,`
29. `related_name='subscribed',`
30. `)`
31. `object_id = models.PositiveIntegerField()`
32. `content_object = generic.GenericForeignKey('content_type', 'object_id')`
33. ``
34. `creation_date = models.DateTimeField(`
35. `auto_now_add=True,`
36. `verbose_name=_('Creation date'),`
37. `)`
38. ``
39. `def __unicode__(self):`
40. `return '{0} subscribed to {1}'.format(`
41. `self.user.email, self.content_object)`