question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CreationDateTimeField is not editable even with editable=True in version 1.5.7

See original GitHub issue

I have a test that is passing using django-extensions 1.5.5 but fails in 1.5.7. The test tries to set a CreationDateTimeField and save a model, but the model does not get updated.

I have the following abstract model that some of my models inherit from:

class AuditModel(models.Model):
    date_created = fields.CreationDateTimeField(editable=True)
    # ...

    class Meta:
        abstract = True

And a model that extends AuditModel:

class SetPasswordToken(AuditModel):
    # Other fields

Here’s the test:

def test_set_password_redirects_to_login_if_older_than_30_days(self):
    user = UserFactory()
    token = SetPasswordToken.objects.create(user=user,
                                            date_created=timezone.now() - relativedelta(days=60))

    # Test that relies on date_created not being today

When I use pdb after creating a SetPasswordToken I see that token.date_created is set to today, even though it is supposed to be set to 60 days ago. I also tried creating a token, explicitly setting token.date_created, then calling token.save() and it still will not be set to 60 days ago. This test works properly on version 1.5.5.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
blueyedcommented, Jan 3, 2020
0reactions
trbscommented, Jan 20, 2020

Better to keep this closed and directly submit a PR 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

contenteditable - HTML: HyperText Markup Language | MDN
Chrome Edge contenteditable Full support. ChromeYes. Toggle history Full suppo... contenteditable="caret". Experimental Full support. ChromeYes. Toggle history Full suppo... contenteditable="events". Experimental Full support. ChromeYes. Toggle history...
Read more >
contenteditable=false inside contenteditable=true block is still ...
It worked! So, to make a span NON-contenteditable inside a contenteditable div, you just set its contenteditable attribute to true !
Read more >
HTML Global contenteditable Attribute - W3Schools
The contenteditable attribute specifies whether the content of an element is editable or not. Note: When the contenteditable attribute is not set on...
Read more >
Make a HTML element editable with contenteditable
Apply the contenteditable attribute and you can edit it similar to or . Users can click on the text and make an update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found