python - Django: Naive datetime while time zone support is active (sqlite) -
I'm going around it in the circle and need some help me a Here's the warning: and relevant (I think) my Part of the settings file: Is this a sqlite issue (I'm still testing things )? Or am I missing something fundamental here? I have read more on this, of course, on the docs. But I'm stumped. Thank you. An error is occurring when I run my test ... I left the readied content here but you Idea should get: django.test import from django.test import testcase django.contrib.auth import get_user_model video.models import video, video from ACC class video test case (test case): def setUp (self) : User = get_user_model (). Objects.create_user (user name = 'yakub', email = 'jacob@test.com', password = 'top_secret') self.video_account = VideoAccount.objects.create (ACCOUNT_TYPE = 1, ACCOUNT_ID = 12345, display_name = "test account "Self.pk1 = Video.objects.create (video_type = 1, video_id =" Q7X3fyId2U0 ", video_account = self.video_account, owner = user) def test_video_creation (self):" "" creates a video object "" self. AssertEqual (Self.pk1.video_id, "Q7X3fyId2U0") self.assertEqual (self.pk1.video_link, "https://www.youtube.com/watch?v=Q7X3fyId2U0") So I thought this in the end and let me tell about the input of everybody who is right to me Wondering in the way: One of my previous migrations was Update: This should be experience time zone Issue of warning is continuing. I am not sure what mistake I am getting! ARG.
/ Django / db / model / regions / __ init__.py:1222: RuntimeWarning: DateTimeField Video.modified Receives an inexperienced datetime (2014- 10-07 00:00:00) While the time zone support is active. RuntimeWarning) Here is the code (some revised): Import the django.db from the imported model django.utils from the time zone category itemBase (model. Model) to
): Created = models.DateTimeField (editable = false) Modified = models.DateTimeField (editable = false) Category Meta: = Abstract True def save (self, * args, ** kwargs): "save" Update timestamps on "" "if self.id: self.created = timezone.now () self.modified = timezone.now () Return super (ItemBase, self) .save (* args, ** kwargs) class video ( ItemBase): Pass
TIME_ZONE = 'UTC' USE_TZ = true
Edit: The added test that throws an error
datetime.date.today () as the default value (which is a signal migration). I did not think about that because at that time when I had no data in the model and still, even then that migration was migrated again (further down the road), it seems that the exam system is running every migration Every time it starts, therefore: that conscious Subjected was getting.
Comments
Post a Comment