parent
8c501cf69d
commit
c6b55e032e
9 changed files with 68 additions and 4 deletions
@ -0,0 +1 @@ |
|||||||
|
__author__ = 'OG' |
||||||
@ -0,0 +1 @@ |
|||||||
|
__author__ = 'OG' |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
from django.core.management.base import BaseCommand, CommandError |
||||||
|
from django.utils import timezone |
||||||
|
from main.models import ProductsUpdate |
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand): |
||||||
|
def handle(self, *args, **options): |
||||||
|
p = ProductsUpdate.objects.last() |
||||||
|
if not p: |
||||||
|
p = ProductsUpdate.objects.create(created=timezone.now()) |
||||||
|
p.created = timezone.now() |
||||||
|
p.save() |
||||||
|
self.stdout.write('{}'.format(p.created)) |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from __future__ import unicode_literals |
||||||
|
|
||||||
|
from django.db import models, migrations |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('main', '0010_auto_20150701_1216'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.CreateModel( |
||||||
|
name='ProductsUpdate', |
||||||
|
fields=[ |
||||||
|
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)), |
||||||
|
('created', models.DateTimeField(auto_now=True, verbose_name='Дата и время')), |
||||||
|
], |
||||||
|
), |
||||||
|
] |
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue