Replace dotted notation FKs with actual objects
This commit is contained in:
parent
2ec9449e38
commit
5f311ca7bd
3 changed files with 16 additions and 17 deletions
|
@ -16,6 +16,7 @@ from markitup.fields import MarkupField
|
||||||
from model_utils.managers import InheritanceManager
|
from model_utils.managers import InheritanceManager
|
||||||
|
|
||||||
from symposion.conference.models import Section
|
from symposion.conference.models import Section
|
||||||
|
from symposion.speakers.models import Speaker
|
||||||
|
|
||||||
|
|
||||||
class ProposalSection(models.Model):
|
class ProposalSection(models.Model):
|
||||||
|
@ -103,8 +104,8 @@ class ProposalBase(models.Model):
|
||||||
default=now,
|
default=now,
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
speaker = models.ForeignKey("speakers.Speaker", related_name="proposals")
|
speaker = models.ForeignKey(Speaker, related_name="proposals")
|
||||||
additional_speakers = models.ManyToManyField("speakers.Speaker", through="AdditionalSpeaker",
|
additional_speakers = models.ManyToManyField(Speaker, through="AdditionalSpeaker",
|
||||||
blank=True)
|
blank=True)
|
||||||
cancelled = models.BooleanField(default=False)
|
cancelled = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ class AdditionalSpeaker(models.Model):
|
||||||
(SPEAKING_STATUS_DECLINED, _("Declined")),
|
(SPEAKING_STATUS_DECLINED, _("Declined")),
|
||||||
]
|
]
|
||||||
|
|
||||||
speaker = models.ForeignKey("speakers.Speaker")
|
speaker = models.ForeignKey(Speaker)
|
||||||
proposalbase = models.ForeignKey(ProposalBase)
|
proposalbase = models.ForeignKey(ProposalBase)
|
||||||
status = models.IntegerField(choices=SPEAKING_STATUS, default=SPEAKING_STATUS_PENDING)
|
status = models.IntegerField(choices=SPEAKING_STATUS, default=SPEAKING_STATUS_PENDING)
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ class ReviewAssignment(models.Model):
|
||||||
(AUTO_ASSIGNED_LATER, "auto-assigned, later"),
|
(AUTO_ASSIGNED_LATER, "auto-assigned, later"),
|
||||||
]
|
]
|
||||||
|
|
||||||
proposal = models.ForeignKey("proposals.ProposalBase")
|
proposal = models.ForeignKey(ProposalBase)
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
|
|
||||||
origin = models.IntegerField(choices=ORIGIN_CHOICES)
|
origin = models.IntegerField(choices=ORIGIN_CHOICES)
|
||||||
|
|
||||||
assigned_at = models.DateTimeField(default=datetime.now)
|
assigned_at = models.DateTimeField(default=datetime.now)
|
||||||
opted_out = models.BooleanField()
|
opted_out = models.BooleanField(default=False)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_assignments(cls, proposal, origin=AUTO_ASSIGNED_INITIAL):
|
def create_assignments(cls, proposal, origin=AUTO_ASSIGNED_INITIAL):
|
||||||
|
@ -92,7 +92,7 @@ class ReviewAssignment(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class ProposalMessage(models.Model):
|
class ProposalMessage(models.Model):
|
||||||
proposal = models.ForeignKey("proposals.ProposalBase", related_name="messages")
|
proposal = models.ForeignKey(ProposalBase, related_name="messages")
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
|
|
||||||
message = MarkupField()
|
message = MarkupField()
|
||||||
|
@ -105,7 +105,7 @@ class ProposalMessage(models.Model):
|
||||||
class Review(models.Model):
|
class Review(models.Model):
|
||||||
VOTES = VOTES
|
VOTES = VOTES
|
||||||
|
|
||||||
proposal = models.ForeignKey("proposals.ProposalBase", related_name="reviews")
|
proposal = models.ForeignKey(ProposalBase, related_name="reviews")
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
|
|
||||||
# No way to encode "-0" vs. "+0" into an IntegerField, and I don't feel
|
# No way to encode "-0" vs. "+0" into an IntegerField, and I don't feel
|
||||||
|
@ -184,7 +184,7 @@ class Review(models.Model):
|
||||||
class LatestVote(models.Model):
|
class LatestVote(models.Model):
|
||||||
VOTES = VOTES
|
VOTES = VOTES
|
||||||
|
|
||||||
proposal = models.ForeignKey("proposals.ProposalBase", related_name="votes")
|
proposal = models.ForeignKey(ProposalBase, related_name="votes")
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
|
|
||||||
# No way to encode "-0" vs. "+0" into an IntegerField, and I don't feel
|
# No way to encode "-0" vs. "+0" into an IntegerField, and I don't feel
|
||||||
|
@ -205,7 +205,7 @@ class LatestVote(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class ProposalResult(models.Model):
|
class ProposalResult(models.Model):
|
||||||
proposal = models.OneToOneField("proposals.ProposalBase", related_name="result")
|
proposal = models.OneToOneField(ProposalBase, related_name="result")
|
||||||
score = models.DecimalField(max_digits=5, decimal_places=2, default=Decimal("0.00"))
|
score = models.DecimalField(max_digits=5, decimal_places=2, default=Decimal("0.00"))
|
||||||
comment_count = models.PositiveIntegerField(default=0)
|
comment_count = models.PositiveIntegerField(default=0)
|
||||||
vote_count = models.PositiveIntegerField(default=0)
|
vote_count = models.PositiveIntegerField(default=0)
|
||||||
|
@ -281,15 +281,12 @@ class ProposalResult(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class Comment(models.Model):
|
class Comment(models.Model):
|
||||||
proposal = models.ForeignKey("proposals.ProposalBase", related_name="comments")
|
proposal = models.ForeignKey(ProposalBase, related_name="comments")
|
||||||
commenter = models.ForeignKey(User)
|
commenter = models.ForeignKey(User)
|
||||||
text = MarkupField()
|
text = MarkupField()
|
||||||
|
|
||||||
# Or perhaps more accurately, can the user see this comment.
|
# Or perhaps more accurately, can the user see this comment.
|
||||||
public = models.BooleanField(choices=[
|
public = models.BooleanField(choices=[(True, "public"), (False, "private")], default=False)
|
||||||
(True, "public"),
|
|
||||||
(False, "private"),
|
|
||||||
])
|
|
||||||
commented_at = models.DateTimeField(default=datetime.now)
|
commented_at = models.DateTimeField(default=datetime.now)
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,7 +300,7 @@ class NotificationTemplate(models.Model):
|
||||||
|
|
||||||
class ResultNotification(models.Model):
|
class ResultNotification(models.Model):
|
||||||
|
|
||||||
proposal = models.ForeignKey("proposals.ProposalBase", related_name="notifications")
|
proposal = models.ForeignKey(ProposalBase, related_name="notifications")
|
||||||
template = models.ForeignKey(NotificationTemplate, null=True, blank=True,
|
template = models.ForeignKey(NotificationTemplate, null=True, blank=True,
|
||||||
on_delete=models.SET_NULL)
|
on_delete=models.SET_NULL)
|
||||||
timestamp = models.DateTimeField(default=datetime.now)
|
timestamp = models.DateTimeField(default=datetime.now)
|
||||||
|
|
|
@ -7,6 +7,7 @@ from markitup.fields import MarkupField
|
||||||
|
|
||||||
from symposion.proposals.models import ProposalBase
|
from symposion.proposals.models import ProposalBase
|
||||||
from symposion.conference.models import Section
|
from symposion.conference.models import Section
|
||||||
|
from symposion.speakers.models import Speaker
|
||||||
|
|
||||||
|
|
||||||
class Schedule(models.Model):
|
class Schedule(models.Model):
|
||||||
|
@ -151,8 +152,8 @@ class Presentation(models.Model):
|
||||||
title = models.CharField(max_length=100)
|
title = models.CharField(max_length=100)
|
||||||
description = MarkupField()
|
description = MarkupField()
|
||||||
abstract = MarkupField()
|
abstract = MarkupField()
|
||||||
speaker = models.ForeignKey("speakers.Speaker", related_name="presentations")
|
speaker = models.ForeignKey(Speaker, related_name="presentations")
|
||||||
additional_speakers = models.ManyToManyField("speakers.Speaker", related_name="copresentations",
|
additional_speakers = models.ManyToManyField(Speaker, related_name="copresentations",
|
||||||
blank=True)
|
blank=True)
|
||||||
cancelled = models.BooleanField(default=False)
|
cancelled = models.BooleanField(default=False)
|
||||||
proposal_base = models.OneToOneField(ProposalBase, related_name="presentation")
|
proposal_base = models.OneToOneField(ProposalBase, related_name="presentation")
|
||||||
|
|
Loading…
Reference in a new issue