Skip to content
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

Replace auto_now and auto_now_add with defaults which can be overridden #93

Merged
merged 1 commit into from
Feb 24, 2017

Conversation

rowanseymour
Copy link
Member

No description provided.

@rowanseymour rowanseymour self-assigned this Feb 23, 2017
@@ -15,6 +15,5 @@ celerybeat-schedule

*.DS_Store
.tox/
test-runner/env/
test-runner/smartmin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't exist

csv_imports/
!smartmin/csv_imports/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this so we exclude /csv_imports but include /smartmin/csv_imports/

@@ -37,15 +36,23 @@ class SmartModel(models.Model):
created_by = models.ForeignKey(settings.AUTH_USER_MODEL,
related_name="%(app_label)s_%(class)s_creations",
help_text="The user which originally created this item")
created_on = models.DateTimeField(auto_now_add=True,
created_on = models.DateTimeField(default=timezone.now, editable=False, blank=True,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank=True and editable=False were automatically set by auto_now and auto_now_add (see https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.DateField.auto_now)

@@ -240,12 +247,12 @@ def import_xls(cls, filename, user, import_params, log=None, import_results=None
num_errors += 1

except SmartImportRowError as e:
error_messages.append(dict(line=line_number+1, error=text_type(e)))
error_messages.append(dict(line=line_number+1, error=six.text_type(e)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making this consistent with how the method is called elsewhere in this file

@coveralls
Copy link

coveralls commented Feb 23, 2017

Coverage Status

Coverage increased (+0.1%) to 80.0% when pulling 038911b on replace_auto_now into 27547b3 on master.

Copy link
Collaborator

@nicpottier nicpottier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤙

@rowanseymour rowanseymour merged commit e52c339 into master Feb 24, 2017
@rowanseymour rowanseymour deleted the replace_auto_now branch February 24, 2017 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants