Modified files
app/models.py
---
+++
@@ -1,3 +1,26 @@
from django.db import models
+from django.contrib.auth.models import AbstractUser
-# Create your models here.
+
+ARTICLE_STATUS = (
+ ("draft", "draft"),
+ ("inprogress", "in progress"),
+ ("published", "published"),
+)
+
+
+class UserProfile(AbstractUser):
+ pass
+
+class Article(models.Model):
+ title = models.CharField(max_length=100)
+ content = models.TextField(blank=True, default="")
+ word_count = models.IntegerField()
+ twitter_post = models.TextField(blank=True, default="")
+ status = models.CharField(
+ max_length=20,
+ choices=ARTICLE_STATUS,
+ default="draft",
+ )
+ created_at = models.DateTimeField(auto_now_add=True)
+ updated_at = models.DateTimeField(auto_now=True)
app/admin.py
---
+++
@@ -1,3 +1,6 @@
from django.contrib import admin
+from app.models import Article, UserProfile
-# Register your models here.
+
+admin.site.register(Article)
+admin.site.register(UserProfile)
djangocourse/settings.py
---
+++
@@ -81,6 +81,8 @@
}
}
+AUTH_USER_MODEL = "app.UserProfile"
+
# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators