Compare commits
No commits in common. "47bbec8dfe9d5a2edf39ef916a5bc281718dd77f" and "2dae59225844fc3c515a652bf48709142b584cfa" have entirely different histories.
47bbec8dfe
...
2dae592258
@ -1,5 +1,3 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from blog.models import *
|
# Register your models here.
|
||||||
|
|
||||||
admin.site.register(Post)
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Generated by Django 4.0 on 2022-01-08 06:45
|
# Generated by Django 4.0 on 2022-01-07 23:05
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@ -9,7 +8,6 @@ class Migration(migrations.Migration):
|
|||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('auth', '0012_alter_user_first_name_max_length'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@ -17,13 +15,10 @@ class Migration(migrations.Migration):
|
|||||||
name='Post',
|
name='Post',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('created', models.DateTimeField(auto_now_add=True)),
|
('title', models.CharField(max_length=200, unique=True)),
|
||||||
('title', models.CharField(blank=True, default='', max_length=100)),
|
('updated_on', models.DateTimeField(auto_now=True)),
|
||||||
('body', models.TextField(blank=True, default='')),
|
('created_on', models.DateTimeField(auto_now_add=True)),
|
||||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='posts', to='auth.user')),
|
('content', models.TextField()),
|
||||||
],
|
],
|
||||||
options={
|
|
||||||
'ordering': ['created'],
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -8,11 +8,11 @@ STATUS = (
|
|||||||
(1,"Publish")
|
(1,"Publish")
|
||||||
)
|
)
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Post(models.Model):
|
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
|
||||||
title = models.CharField(max_length=100, blank=True, default='')
|
|
||||||
body = models.TextField(blank=True, default='')
|
|
||||||
owner = models.ForeignKey('auth.User', related_name='posts', on_delete=models.CASCADE)
|
|
||||||
|
|
||||||
class Meta:
|
class Post(models.Model):
|
||||||
ordering = ['created']
|
title = models.CharField(max_length=200, unique=True)
|
||||||
|
# author = models.ForeignKey('user.auth',on_delete=models.CASCADE)
|
||||||
|
updated_on =models.DateTimeField(auto_now= True)
|
||||||
|
created_on = models.DateTimeField(auto_now_add=True)
|
||||||
|
content = models.TextField()
|
||||||
|
# status = models.IntegerChoices()
|
@ -128,9 +128,5 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||||
'PAGE_SIZE': 10,
|
'PAGE_SIZE': 10
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
|
||||||
'rest_framework.authentication.BasicAuthentication',
|
|
||||||
'rest_framework.authentication.SessionAuthentication',
|
|
||||||
]
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user