aboutsummaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-07-29 23:01:55 +0530
committerBobby <[email protected]>2022-07-29 23:01:55 +0530
commitb14dc2abc25e59e66237fef8d9c2b55ad9592dcf (patch)
tree0ca5d60d97970ae143fc7221cfeb2020b60ed758 /users
parent88057646dbd4876e0658e2e1ee35756c73db607a (diff)
downloadthatcomputerscientist-b14dc2abc25e59e66237fef8d9c2b55ad9592dcf.tar.xz
thatcomputerscientist-b14dc2abc25e59e66237fef8d9c2b55ad9592dcf.zip
Account Page with Fetched Information from the database
Diffstat (limited to 'users')
-rw-r--r--users/admin.py3
-rw-r--r--users/migrations/0001_initial.py29
-rw-r--r--users/models.py17
3 files changed, 48 insertions, 1 deletions
diff --git a/users/admin.py b/users/admin.py
index 8c38f3f3..f5116502 100644
--- a/users/admin.py
+++ b/users/admin.py
@@ -1,3 +1,6 @@
from django.contrib import admin
# Register your models here.
+from .models import UserProfile
+
+admin.site.register(UserProfile)
diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py
new file mode 100644
index 00000000..fd66accf
--- /dev/null
+++ b/users/migrations/0001_initial.py
@@ -0,0 +1,29 @@
+# Generated by Django 4.0.6 on 2022-07-29 15:58
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='UserProfile',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('location', models.CharField(blank=True, max_length=50)),
+ ('bio', models.TextField(blank=True)),
+ ('gravatar_email', models.EmailField(blank=True, max_length=254)),
+ ('is_public', models.BooleanField(default=False)),
+ ('email_public', models.BooleanField(default=False)),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ ),
+ ]
diff --git a/users/models.py b/users/models.py
index 71a83623..b67b1274 100644
--- a/users/models.py
+++ b/users/models.py
@@ -1,3 +1,18 @@
+from django.conf import settings
from django.db import models
-# Create your models here.
+# User Profile Model
+class UserProfile(models.Model):
+ user = models.ForeignKey(
+ settings.AUTH_USER_MODEL,
+ on_delete=models.CASCADE,
+ )
+ location = models.CharField(max_length=50, blank=True)
+ bio = models.TextField(blank=True)
+ gravatar_email = models.EmailField(blank=True)
+ is_public = models.BooleanField(default=False)
+ email_public = models.BooleanField(default=False)
+
+ def __str__(self):
+ return self.user.username
+