-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup DRF in test app, add Booking app for tenants
- Loading branch information
1 parent
3b7a3f1
commit aa57f08
Showing
14 changed files
with
167 additions
and
6 deletions.
There are no files selected for viewing
Empty file.
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 BookingsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "django_test_app.bookings" |
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,33 @@ | ||
# Generated by Django 4.2.15 on 2024-09-13 04:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Booking", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("booking_agent_name", models.CharField(max_length=64)), | ||
("booking_description", models.TextField()), | ||
("booking_type", models.CharField(max_length=100)), | ||
("booking_date", models.DateField()), | ||
("created", models.DateTimeField(auto_now_add=True)), | ||
("updated", models.DateTimeField(auto_now=True)), | ||
], | ||
), | ||
] |
Empty file.
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,16 @@ | ||
from django.db import models | ||
|
||
|
||
# Create your models here. | ||
class Booking(models.Model): | ||
"""Test Tenant object.""" | ||
|
||
booking_agent_name = models.CharField(max_length=64) | ||
booking_description = models.TextField() | ||
booking_type = models.CharField(max_length=100) | ||
booking_date = models.DateField() | ||
created = models.DateTimeField(auto_now_add=True) | ||
updated = models.DateTimeField(auto_now=True) | ||
|
||
def __str__(self): | ||
return self.booking_agent_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,9 @@ | ||
from rest_framework import serializers | ||
|
||
from django_test_app.bookings.models import Booking | ||
|
||
|
||
class BookingSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Booking | ||
fields = "__all__" |
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,12 @@ | ||
from rest_framework import viewsets | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
from django_test_app.bookings.models import Booking | ||
from django_test_app.bookings.serializers import BookingSerializer | ||
|
||
|
||
# Create your views here. | ||
class BookingViewSet(viewsets.ModelViewSet): | ||
queryset = Booking.objects.all() | ||
serializer_class = BookingSerializer | ||
permission_classes = (IsAuthenticated,) |
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
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
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
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,5 +1,4 @@ | ||
from django.db import migrations, models | ||
|
||
from tenant_users.permissions.models import PermissionsMixinFacade | ||
|
||
|
||
|
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,5 +1,4 @@ | ||
from django.db import models | ||
|
||
from tenant_users.tenants.models import UserProfile | ||
|
||
_NameFieldLength = 64 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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