delete datetext functions, implement dateutils
This commit is contained in:
@@ -9,7 +9,6 @@ from django.db import models, transaction
|
||||
from django.db.models.fields import BooleanField, DateTimeField, DecimalField, TextField, FloatField, IntegerField
|
||||
from django.db.utils import IntegrityError
|
||||
from django.template import defaultfilters
|
||||
from django.utils.translation import ugettext
|
||||
|
||||
from ccx_keys.locator import CCXLocator
|
||||
from model_utils.models import TimeStampedModel
|
||||
@@ -18,9 +17,7 @@ from opaque_keys.edx.keys import CourseKey
|
||||
from config_models.models import ConfigurationModel
|
||||
from lms.djangoapps import django_comment_client
|
||||
from openedx.core.djangoapps.models.course_details import CourseDetails
|
||||
from pytz import utc
|
||||
from static_replace.models import AssetBaseUrlConfig
|
||||
from util.date_utils import strftime_localized
|
||||
from xmodule import course_metadata_utils, block_metadata_utils
|
||||
from xmodule.course_module import CourseDescriptor, DEFAULT_START_DATE
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
@@ -359,21 +356,6 @@ class CourseOverview(TimeStampedModel):
|
||||
"""
|
||||
return course_metadata_utils.course_starts_within(self.start, days)
|
||||
|
||||
def start_datetime_text(self, format_string="SHORT_DATE", time_zone=utc):
|
||||
"""
|
||||
Returns the desired text corresponding to the course's start date and
|
||||
time in the specified time zone, or utc if no time zone given.
|
||||
Prefers .advertised_start, then falls back to .start.
|
||||
"""
|
||||
return course_metadata_utils.course_start_datetime_text(
|
||||
self.start,
|
||||
self.advertised_start,
|
||||
format_string,
|
||||
time_zone,
|
||||
ugettext,
|
||||
strftime_localized
|
||||
)
|
||||
|
||||
@property
|
||||
def start_date_is_still_default(self):
|
||||
"""
|
||||
@@ -385,18 +367,6 @@ class CourseOverview(TimeStampedModel):
|
||||
self.advertised_start,
|
||||
)
|
||||
|
||||
def end_datetime_text(self, format_string="SHORT_DATE", time_zone=utc):
|
||||
"""
|
||||
Returns the end date or datetime for the course formatted as a string.
|
||||
|
||||
"""
|
||||
return course_metadata_utils.course_end_datetime_text(
|
||||
self.end,
|
||||
format_string,
|
||||
time_zone,
|
||||
strftime_localized
|
||||
)
|
||||
|
||||
@property
|
||||
def sorting_score(self):
|
||||
"""
|
||||
|
||||
@@ -127,10 +127,6 @@ class CourseOverviewTestCase(ModuleStoreTestCase):
|
||||
('clean_id', ('#',)),
|
||||
('has_ended', ()),
|
||||
('has_started', ()),
|
||||
('start_datetime_text', ('SHORT_DATE',)),
|
||||
('start_datetime_text', ('DATE_TIME',)),
|
||||
('end_datetime_text', ('SHORT_DATE',)),
|
||||
('end_datetime_text', ('DATE_TIME',)),
|
||||
('may_certify', ()),
|
||||
]
|
||||
for method_name, method_args in methods_to_test:
|
||||
|
||||
Reference in New Issue
Block a user