Skip to content

Commit

Permalink
[Oops] dos2unix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBirdie authored and TheBirdie committed Feb 15, 2016
1 parent 60e90db commit 323213c
Showing 1 changed file with 49 additions and 48 deletions.
97 changes: 49 additions & 48 deletions sigma_publications/models.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
from django.db import models

from sigma_core.models.user import User
from sigma_core.models.group import Group

class Publication(models.Model):
"""
Modelize a Publication. A Publication can be posted to a Group with the GroupPost model.
"""

# Warning! Both can be NULL !
poster_user = models.ForeignKey(User, null=True, related_name='created_publications', on_delete=models.SET_NULL)
poster_group = models.ForeignKey(Group, null=True, related_name='created_publications', on_delete=models.SET_NULL)

# Link to event ?
created = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=255)
body = models.TextField()

posted_in = models.ManyToManyField(Group, through='GroupPost', related_name="publications")

# Related fields
# - comments (model PublicationComment)
# - posts (model GroupPost)
# - posted_in (model Group.publications through GroupPost)

class GroupPost(models.Model):
"""
Modelize a Post on a Group. A Post is a link between a Publication and a Group.
"""

# Poster ?
group = models.ForeignKey(Group, related_name='posts', on_delete=models.CASCADE)
publication = models.ForeignKey(Publication, related_name='posts', on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)


class PublicationComment(models.Model):
"""
Modelize a comment on a Publication
"""

user = models.ForeignKey(User, related_name='comments', on_delete=models.CASCADE)
publication = models.ForeignKey('Publication', related_name='comments', on_delete=models.CASCADE)

created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
comment = models.TextField()
from django.db import models

from sigma_core.models.user import User
from sigma_core.models.group import Group

class Publication(models.Model):
"""
Modelize a Publication. A Publication can be posted to a Group with the GroupPost model.
"""

# Warning! Both can be NULL !
poster_user = models.ForeignKey(User, null=True, related_name='created_publications', on_delete=models.SET_NULL)
poster_group = models.ForeignKey(Group, null=True, related_name='created_publications', on_delete=models.SET_NULL)

# Link to event ?
created = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=255)
body = models.TextField()

posted_in = models.ManyToManyField(Group, through='GroupPost', related_name="publications")

# Related fields
# - comments (model PublicationComment)
# - posts (model GroupPost)
# - posted_in (model Group.publications through GroupPost)


class GroupPost(models.Model):
"""
Modelize a Post on a Group. A Post is a link between a Publication and a Group.
"""

# Poster ?
group = models.ForeignKey(Group, related_name='posts', on_delete=models.CASCADE)
publication = models.ForeignKey(Publication, related_name='posts', on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)


class PublicationComment(models.Model):
"""
Modelize a comment on a Publication
"""

user = models.ForeignKey(User, related_name='comments', on_delete=models.CASCADE)
publication = models.ForeignKey('Publication', related_name='comments', on_delete=models.CASCADE)

created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
comment = models.TextField()

0 comments on commit 323213c

Please sign in to comment.