Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend #14

Merged
merged 22 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
backend: author model
  • Loading branch information
rkshaon committed Sep 6, 2024
commit 687219e6f4c990027f03e0bda2ceea795e6d8df0
24 changes: 24 additions & 0 deletions backend/author_api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.1 on 2024-09-06 19:40

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Author',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=100)),
('last_name', models.CharField(max_length=100)),
('biography', models.TextField(blank=True, null=True)),
('birth_date', models.DateField(blank=True, null=True)),
],
),
]
14 changes: 13 additions & 1 deletion backend/author_api/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from django.db import models

# Create your models here.

class Author(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
biography = models.TextField(blank=True, null=True) # Optional bio field
birth_date = models.DateField(null=True, blank=True)

def __str__(self):
return f'{self.first_name} {self.last_name}'

@property
def full_name(self):
return f"{self.first_name} {self.last_name}"
Binary file modified backend/db.sqlite3
Binary file not shown.