Commit a2727c82 authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

updated forms.py

parent a0c246cc
from django import forms
from django.db import models
from models import Author
from .models import Books, Author
class AuthorForm(forms.Form):
first_name = forms.CharField(label='first_name', max_length=50)
last_name = forms.CharField(label='last_name', max_length=50)
age = forms.IntegerField(label='age')
nationality = forms.CharField(label='nationality', max_length=50)
bio = forms.TextField(label='bio', max_length=700)
class AuthorForm(forms.ModelForm):
class Meta:
model = Author
fields = "__all__"
class BookForm(forms.Form):
title = forms.CharField(label='title', max_length=50)
author = forms.ForeignKey(Author, on_delete=models.CASCADE)
publisher = forms.CharField(label='publisher', max_length=50)
year_published = forms.IntegerField(label='year_published', max_length=50)
ISBN = forms.CharField(label='ISBN', max_length=50)
blurb = forms.CharField(label='blurb', max_length=50)
\ No newline at end of file
class BookForm(forms.ModelForm):
class Meta:
model = Books
fields = "__all__"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment