forked from tshegofatsoseane/pillow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Update] - Added more fields for properties + landlord. Added more mo…
…dels: students + reviews
- Loading branch information
1 parent
851fca7
commit 09075b2
Showing
139 changed files
with
639 additions
and
47 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-163 Bytes
backend/amenities/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+640 Bytes
...s/__pycache__/serializers.cpython-310.pyc → ...s/__pycache__/serializers.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+1.41 KB
...enities/__pycache__/views.cpython-310.pyc → ...enities/__pycache__/views.cpython-310.pyc
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
backend/api/amenities/migrations/0003_remove_amenity_property_amenity_description.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.0.6 on 2024-06-14 01:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('amenities', '0002_amenity_property'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='amenity', | ||
name='property', | ||
), | ||
migrations.AddField( | ||
model_name='amenity', | ||
name='description', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
] |
File renamed without changes.
Binary file renamed
BIN
+670 Bytes
.../__pycache__/0001_initial.cpython-310.pyc → .../__pycache__/0001_initial.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+786 Bytes
...e__/0002_amenity_property.cpython-310.pyc → ...e__/0002_amenity_property.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+691 Bytes
...s/migrations/__pycache__/0003_remove_amenity_property_amenity_description.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+167 Bytes
backend/api/amenities/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
from django.db import models | ||
from properties.models import Property | ||
|
||
|
||
class Amenity(models.Model): | ||
name = models.CharField(max_length=255, unique=True) | ||
property = models.ForeignKey(Property, on_delete=models.CASCADE, related_name='amenities', null=True, blank=True) | ||
description = models.TextField(blank=True, null=True) | ||
|
||
def __str__(self): | ||
return self.name |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+976 Bytes
...s/__pycache__/serializers.cpython-310.pyc → ...s/__pycache__/serializers.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+480 Bytes
...andlords/__pycache__/urls.cpython-310.pyc → ...andlords/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+5.87 KB
...ndlords/__pycache__/views.cpython-310.pyc → ...ndlords/__pycache__/views.cpython-310.pyc
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
.../api/landlords/migrations/0003_landlord_company_address_landlord_company_name_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 5.0.6 on 2024-06-14 00:47 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('landlords', '0002_remove_landlord_name'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='landlord', | ||
name='company_address', | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='landlord', | ||
name='company_name', | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='landlord', | ||
name='date_of_birth', | ||
field=models.DateField(blank=True, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='landlord', | ||
name='gender', | ||
field=models.CharField(blank=True, max_length=10, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='landlord', | ||
name='phone_number', | ||
field=models.CharField(blank=True, max_length=20, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='landlord', | ||
name='street_address', | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='landlord', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
] |
File renamed without changes.
Binary file renamed
BIN
+2.03 KB
.../__pycache__/0001_initial.cpython-310.pyc → .../__pycache__/0001_initial.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+530 Bytes
backend/api/landlords/migrations/__pycache__/0002_remove_landlord_name.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+1.01 KB
.../__pycache__/0003_landlord_company_address_landlord_company_name_and_more.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+167 Bytes
backend/api/landlords/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import AbstractUser | ||
|
||
|
||
class Landlord(AbstractUser): | ||
|
||
# Basic information | ||
username = None | ||
email = models.EmailField(unique=True) | ||
password = models.CharField(max_length=255) | ||
phone_number = models.CharField(max_length=20, null=True, blank=True) | ||
date_of_birth = models.DateField(null=True, blank=True) | ||
gender = models.CharField(max_length=10, null=True, blank=True) | ||
|
||
# Address | ||
street_address = models.CharField(max_length=255, null=True, blank=True) | ||
|
||
# Company | ||
company_name = models.CharField(max_length=255, null=True, blank=True) | ||
company_address = models.CharField(max_length=255, null=True, blank=True) | ||
|
||
# Metadata | ||
is_active = models.BooleanField(default=True) | ||
|
||
USERNAME_FIELD = 'email' | ||
REQUIRED_FIELDS = [] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+464 Bytes
...operties/__pycache__/urls.cpython-310.pyc → ...operties/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+627 Bytes
...perties/__pycache__/utils.cpython-310.pyc → ...perties/__pycache__/utils.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+4.34 KB
...perties/__pycache__/views.cpython-310.pyc → ...perties/__pycache__/views.cpython-310.pyc
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
74 changes: 74 additions & 0 deletions
74
...nd/api/properties/migrations/0005_property_amenities_property_available_rooms_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Generated by Django 5.0.6 on 2024-06-14 01:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('amenities', '0003_remove_amenity_property_amenity_description'), | ||
('properties', '0004_property_latitude_property_longitude'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='property', | ||
name='amenities', | ||
field=models.ManyToManyField(blank=True, to='amenities.amenity'), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='available_rooms', | ||
field=models.PositiveIntegerField(default=1), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='bathrooms', | ||
field=models.PositiveIntegerField(default=1), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='bedrooms', | ||
field=models.PositiveIntegerField(default=1), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='description', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='first_deposit', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='main_image', | ||
field=models.ImageField(blank=True, null=True, upload_to='property_images/'), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='monthly_deposit', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='pets_allowed', | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='property_type', | ||
field=models.CharField(blank=True, max_length=100, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='status', | ||
field=models.CharField(default='available', max_length=20), | ||
), | ||
migrations.AddField( | ||
model_name='property', | ||
name='virtual_tour_link', | ||
field=models.URLField(blank=True, null=True), | ||
), | ||
] |
Empty file.
Binary file renamed
BIN
+1009 Bytes
.../__pycache__/0001_initial.cpython-310.pyc → .../__pycache__/0001_initial.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+649 Bytes
..._/0002_property_amenities.cpython-310.pyc → ..._/0002_property_amenities.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+554 Bytes
backend/api/properties/migrations/__pycache__/0003_remove_property_amenities.cpython-310.pyc
Binary file not shown.
Binary file renamed
BIN
+680 Bytes
...titude_property_longitude.cpython-310.pyc → ...titude_property_longitude.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+1.51 KB
...ons/__pycache__/0005_property_amenities_property_available_rooms_and_more.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+168 Bytes
backend/api/properties/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from django.db import models | ||
from .utils import geocode_address | ||
from api.landlords.models import Landlord | ||
from api.amenities.models import Amenity | ||
|
||
# Create your models here. | ||
class Property(models.Model): | ||
# Basic information | ||
name = models.CharField(max_length=255) | ||
street_address = models.CharField(max_length=255) | ||
nearest_campus = models.CharField(max_length=255) | ||
latitude = models.FloatField(null=True, blank=True) | ||
longitude = models.FloatField(null=True, blank=True) | ||
landlord = models.ForeignKey(Landlord, on_delete=models.CASCADE, related_name='properties') | ||
amenities = models.ManyToManyField(Amenity, blank=True) | ||
|
||
# Finances | ||
first_deposit = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) | ||
monthly_deposit = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) | ||
|
||
# More information | ||
description = models.TextField(blank=True, null=True) | ||
property_type = models.CharField(max_length=100, blank=True, null=True) | ||
bedrooms = models.PositiveIntegerField(default=1) | ||
bathrooms = models.PositiveIntegerField(default=1) | ||
available_rooms = models.PositiveIntegerField(default=1) | ||
status = models.CharField(max_length=20, default='available') | ||
pets_allowed = models.BooleanField(default=False) | ||
main_image = models.ImageField(upload_to='property_images/', blank=True, null=True) | ||
virtual_tour_link = models.URLField(blank=True, null=True) | ||
|
||
def save(self, *args, **kwargs): | ||
location = geocode_address(self.street_address) | ||
if location: | ||
self.latitude = location['lat'] | ||
self.longitude = location['lng'] | ||
super(Property, self).save(*args, **kwargs) | ||
|
||
def __str__(self): | ||
return self.name |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ReviewsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'api.reviews' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0.6 on 2024-06-14 01:51 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('properties', '0005_property_amenities_property_available_rooms_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Review', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('rating', models.PositiveIntegerField(default=0)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('property', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='properties.property')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.0.6 on 2024-06-14 01:51 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('reviews', '0001_initial'), | ||
('students', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='review', | ||
name='user', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='students.student'), | ||
), | ||
] |
Empty file.
Binary file added
BIN
+967 Bytes
backend/api/reviews/migrations/__pycache__/0001_initial.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+717 Bytes
backend/api/reviews/migrations/__pycache__/0002_initial.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+165 Bytes
backend/api/reviews/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.db import models | ||
from api.students.models import Student | ||
from api.properties.models import Property | ||
|
||
|
||
class Review(models.Model): | ||
user = models.ForeignKey(Student, on_delete=models.CASCADE) | ||
property = models.ForeignKey(Property, on_delete=models.CASCADE) | ||
rating = models.PositiveIntegerField(default=0) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
|
||
def __str__(self): | ||
return f'Review by {self.user.email} for {self.property.name}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class StudentsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'api.students' |
Oops, something went wrong.