Test coverage report: subscribe.models

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

Generated: Thu 2013-02-28 14:37 SGT

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

Stats: 8 executed, 0 missed, 6 excluded, 23 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. `)`
25. ``
26. `content_type = models.ForeignKey(ContentType)`
27. `object_id = models.PositiveIntegerField()`
28. `content_object = generic.GenericForeignKey('content_type', 'object_id')`
29. ``
30. `creation_date = models.DateTimeField(`
31. `auto_now_add=True,`
32. `verbose_name=_('Creation date'),`
33. `)`
34. ``
35. `def __unicode__(self):`
36. `return '{0} subscribed to {1}'.format(`
37. `self.user.email, self.content_object)`