blog post init
This commit is contained in:
		
							parent
							
								
									b690967d5d
								
							
						
					
					
						commit
						47bbec8dfe
					
				| @ -1,3 +1,5 @@ | ||||
| from django.contrib import admin | ||||
| 
 | ||||
| # Register your models here. | ||||
| from blog.models import * | ||||
| 
 | ||||
| admin.site.register(Post) | ||||
| @ -1,6 +1,7 @@ | ||||
| # Generated by Django 4.0 on 2022-01-07 23:05 | ||||
| # Generated by Django 4.0 on 2022-01-08 06:45 | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| import django.db.models.deletion | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| @ -8,6 +9,7 @@ class Migration(migrations.Migration): | ||||
|     initial = True | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('auth', '0012_alter_user_first_name_max_length'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
| @ -15,10 +17,13 @@ class Migration(migrations.Migration): | ||||
|             name='Post', | ||||
|             fields=[ | ||||
|                 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||||
|                 ('title', models.CharField(max_length=200, unique=True)), | ||||
|                 ('updated_on', models.DateTimeField(auto_now=True)), | ||||
|                 ('created_on', models.DateTimeField(auto_now_add=True)), | ||||
|                 ('content', models.TextField()), | ||||
|                 ('created', models.DateTimeField(auto_now_add=True)), | ||||
|                 ('title', models.CharField(blank=True, default='', max_length=100)), | ||||
|                 ('body', models.TextField(blank=True, default='')), | ||||
|                 ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='posts', to='auth.user')), | ||||
|             ], | ||||
|             options={ | ||||
|                 'ordering': ['created'], | ||||
|             }, | ||||
|         ), | ||||
|     ] | ||||
|  | ||||
| @ -8,11 +8,11 @@ STATUS = ( | ||||
|     (1,"Publish") | ||||
| ) | ||||
| # Create your models here. | ||||
| 
 | ||||
| class Post(models.Model): | ||||
|     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() | ||||
|     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: | ||||
|         ordering = ['created'] | ||||
		Reference in New Issue
	
	Block a user