blog working

This commit is contained in:
Sharad Ahlawat 2020-03-08 15:01:55 -07:00
parent b0af2e6e46
commit aa3683f2da
5 changed files with 57 additions and 1 deletions

5
.idea/.gitignore vendored
View File

@ -1,2 +1,5 @@
# Default ignored files # Default ignored files
/workspace.xml /workspace.xml
# Datasource local storage ignored files
/dataSources.local.xml
/dataSources/

17
.idea/dataSources.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="db" uuid="4dcbd4e2-fa29-45d8-857f-d700226245d8">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db.sqlite3</jdbc-url>
</data-source>
<data-source source="LOCAL" name="postgres@pg" uuid="a94ca6c3-89cf-476a-999c-ca9fe38200dc">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://pg.ahlawat.com:5432/postgres</jdbc-url>
</data-source>
</component>
</project>

View File

@ -1,3 +1,7 @@
from django.contrib import admin from django.contrib import admin
# Register your models here. # Register your models here.
from .models import Blog
admin.site.register(Blog)

View File

@ -0,0 +1,24 @@
# Generated by Django 3.0.3 on 2020-03-08 20:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Blog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('pubdate', models.DateTimeField()),
('body', models.TextField(max_length=1000)),
('image', models.ImageField(upload_to='images/')),
],
),
]

View File

@ -1,3 +1,11 @@
from django.db import models from django.db import models
import datetime
# Create your models here. # Create your models here.
class Blog(models.Model):
title = models.CharField(max_length=200)
pubdate = models.DateTimeField()
body = models.TextField(max_length=1000)
image = models.ImageField(upload_to='images/')