feat: Dear Diary Project - 6. Create Entry Model
parent
37d7fbec4c
commit
bf69142fc0
@ -1,3 +1,5 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import Entry
|
||||
|
||||
admin.site.register(Entry)
|
||||
|
@ -0,0 +1,25 @@
|
||||
# Generated by Django 2.2.2 on 2019-06-24 03:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Entry',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('text', models.TextField()),
|
||||
('date', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Entries',
|
||||
},
|
||||
),
|
||||
]
|
@ -1,3 +1,11 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
class Entry(models.Model):
|
||||
text = models.TextField()
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = 'Entries'
|
||||
|
||||
def __str__(self):
|
||||
return 'Entry #{}'.format(self.id)
|
||||
|
Loading…
Reference in New Issue