Skip to content

Commit

Permalink
Merge pull request #10 from parkm2ngyu00/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
parkm2ngyu00 authored Aug 11, 2024
2 parents f024f1e + 17cdf71 commit 190ea7b
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 3 deletions.
14 changes: 13 additions & 1 deletion backend/houses/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from django.contrib import admin
from .models import House

# Register your models here.
@admin.register(House)
class HouseAdmin(admin.ModelAdmin):
fields = (
"name",
"address",
("price_per_night", "pets_allowed"),
)
list_display = ("name", "price_per_night", "address", "pets_allowed")
list_filter = ("price_per_night", "pets_allowed")
search_fields = ("address",)
list_display_links = ("name", "address")
list_editable = ("pets_allowed",)
24 changes: 24 additions & 0 deletions backend/houses/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.15 on 2024-08-11 01:11

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='House',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=30)),
('price', models.PositiveIntegerField()),
('description', models.TextField()),
('address', models.CharField(max_length=30)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.15 on 2024-08-11 01:30

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('houses', '0001_initial'),
]

operations = [
migrations.RenameField(
model_name='house',
old_name='price',
new_name='price_per_night',
),
]
18 changes: 18 additions & 0 deletions backend/houses/migrations/0003_house_pets_allowed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.15 on 2024-08-11 01:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('houses', '0002_rename_price_house_price_per_night'),
]

operations = [
migrations.AddField(
model_name='house',
name='pets_allowed',
field=models.BooleanField(default=True),
),
]
15 changes: 13 additions & 2 deletions backend/houses/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
from django.db import models

class House(models.Model):

"""Model Definition for Houses"""

name = models.CharField(max_length=30)
price = models.PositiveIntegerField()
price_per_night = models.PositiveIntegerField(
verbose_name="Price", help_text="Positive Numbers Only"
)
description = models.TextField()
address = models.CharField(max_length=30)
address = models.CharField(max_length=140)
pets_allowed = models.BooleanField(
verbose_name="Pets Allowed?",
default=True,
help_text="Does this house allow pets?",
)

def __str__(self):
return self.name

0 comments on commit 190ea7b

Please sign in to comment.