-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various model.py language fixes #650
Open
comradekingu
wants to merge
2
commits into
CTPUG:master
Choose a base branch
from
comradekingu:patch-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -58,7 +58,7 @@ def __str__(self): | |||||
def clean(self): | ||||||
"""Ensure Schedule blocks are sane.""" | ||||||
if self.start_time >= self.end_time: | ||||||
raise ValidationError("Start time must be before end time") | ||||||
raise ValidationError("Start time must precede end time") | ||||||
# Validate that we don't overlap any existing blocks | ||||||
for other_block in ScheduleBlock.objects.all(): | ||||||
if other_block.pk == self.pk: | ||||||
|
@@ -79,7 +79,7 @@ class Venue(models.Model): | |||||
" conference attendees")) | ||||||
|
||||||
blocks = models.ManyToManyField(ScheduleBlock, | ||||||
help_text=_("Blocks (days) on which this venue will be used.")) | ||||||
help_text=_("Blocks (days) this venue will be used.")) | ||||||
comradekingu marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I like this a bit better. |
||||||
|
||||||
video = models.BooleanField( | ||||||
default=False, | ||||||
|
@@ -149,7 +149,7 @@ def get_formatted_start_time(self): | |||||
|
||||||
def get_formatted_start_date_time(self): | ||||||
return localtime(self.get_start_time()).strftime('%b %d (%a): %H:%M') | ||||||
get_formatted_start_date_time.short_description = _('Start Date & Time') | ||||||
get_formatted_start_date_time.short_description = _('Start Date and Time') | ||||||
|
||||||
def get_formatted_end_time(self): | ||||||
return localtime(self.end_time).strftime('%H:%M') | ||||||
|
@@ -160,7 +160,7 @@ def get_formatted_end_date_time(self): | |||||
def get_duration(self): | ||||||
"""Return the duration of the slot as hours and minutes. | ||||||
|
||||||
Used for the pentabarf export, which needs it in this format.""" | ||||||
Used for the Pentabarf export, which needs it in this format.""" | ||||||
duration = (self.end_time - self.get_start_time()).total_seconds() | ||||||
result = {} | ||||||
result['hours'], result['minutes'] = divmod(duration // 60, 60) | ||||||
|
@@ -185,7 +185,7 @@ def clean(self): | |||||
raise ValidationError("Slots must have a start time" | ||||||
" or previous slot set") | ||||||
if self.end_time and self.get_start_time() >= self.end_time: | ||||||
raise ValidationError("Start time must be before end time") | ||||||
raise ValidationError("The start time must precede the end time") | ||||||
# Slots should either have day + start_time, or a previous_slot, but | ||||||
# not both (since previous_slot overrides the others) | ||||||
if self.start_time and self.previous_slot: | ||||||
|
@@ -194,7 +194,7 @@ def clean(self): | |||||
# Validate that we are within the bounds of the block | ||||||
block = self.get_block() | ||||||
if not block: | ||||||
raise ValidationError("Slot does not fall within any defined block") | ||||||
raise ValidationError("The slot does not fall within any defined block") | ||||||
# Validate that we don't overlap any existing slots | ||||||
# This isn't very efficient, but OK because it's a once off | ||||||
# validation cost. | ||||||
|
@@ -244,15 +244,15 @@ class ScheduleItem(models.Model): | |||||
|
||||||
css_class = models.CharField( | ||||||
max_length=128, null=False, blank=True, | ||||||
help_text=_("Custom css class for this schedule item")) | ||||||
help_text=_("Custom CSS class for this schedule item")) | ||||||
|
||||||
expand = models.BooleanField( | ||||||
null=False, default=False, | ||||||
help_text=_("Expand to neighbouring venues")) | ||||||
|
||||||
last_updated = models.DateTimeField(null=True, blank=True, | ||||||
auto_now=True, | ||||||
help_text=_("Date & Time this was" | ||||||
help_text=_("Date and time this was" | ||||||
" last updated")) | ||||||
|
||||||
def get_title(self): | ||||||
|
@@ -281,7 +281,7 @@ def list_css_classes(self): | |||||
"""Convert get_css_classes into a nice string for the admin interface""" | ||||||
return ', '.join(list(self.get_css_classes())) | ||||||
|
||||||
list_css_classes.short_description = _('Talk Type & Track CSS classes') | ||||||
list_css_classes.short_description = _('CSS classes for talk type and track') | ||||||
|
||||||
def get_desc(self): | ||||||
if self.details: | ||||||
|
@@ -334,7 +334,7 @@ def get_duration(self): | |||||
"""Return the total duration of the item. | ||||||
|
||||||
This is the sum of all the slot durations.""" | ||||||
# This is intended for the pentabarf xml file | ||||||
# This is intended for the Pentabarf XML file | ||||||
# It will do the wrong thing if the slots aren't | ||||||
# contigious, which we should address sometime. | ||||||
slots = list(self.slots.all()) | ||||||
|
@@ -356,7 +356,7 @@ def get_duration_minutes(self): | |||||
|
||||||
@property | ||||||
def guid(self): | ||||||
"""Return a GUID for the ScheduleItem (for frab xml) | ||||||
"""Return a GUID for the ScheduleItem (for frab XML) | ||||||
|
||||||
We return static GUIDs across re-scheduling, when possible. | ||||||
""" | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with this edit, the string doesn't make any sense any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocks this venue will be used on?