-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
254 additions
and
4 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -68,7 +68,8 @@ | |
"blog", | ||
"poll", | ||
"message", | ||
"siteinfo" | ||
"siteinfo", | ||
"giving" | ||
|
||
] | ||
# AUTH_USER_MODEL = "users.CustomUser" | ||
|
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.
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,4 @@ | ||
from django.contrib import admin | ||
from .models import Giving | ||
|
||
admin.site.register(Giving) |
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 GivingConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'giving' |
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,2 @@ | ||
STATUS = (("PENDING", "PENDING"), ("PAID", "PAID"), | ||
("FAILED", "FAILED")) |
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,37 @@ | ||
# Generated by Django 4.0.8 on 2023-01-21 23:14 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Giving', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('amount', models.IntegerField()), | ||
('title', models.CharField(max_length=100)), | ||
('status', models.CharField(choices=[('PENDING', 'PENDING'), ('PAID', 'PAID'), ('FAILED', 'FAILED')], default='PENDING', max_length=20)), | ||
('note', models.CharField(max_length=256)), | ||
('phone', models.CharField(blank=True, max_length=11, null=True)), | ||
('fullname', models.CharField(blank=True, max_length=100, null=True)), | ||
('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')), | ||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='given', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'ordering': ('-created_at',), | ||
}, | ||
), | ||
] |
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,18 @@ | ||
# Generated by Django 4.0.8 on 2023-01-21 23:18 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('giving', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='giving', | ||
name='email', | ||
field=models.EmailField(max_length=254, verbose_name='email address'), | ||
), | ||
] |
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,27 @@ | ||
from django.db import models | ||
from core.models import AuditableModel | ||
from account.models import CustomUser | ||
from .enums import STATUS | ||
# Create your models here. | ||
|
||
|
||
class Giving (AuditableModel): | ||
|
||
user = models.ForeignKey( | ||
CustomUser, on_delete=models.CASCADE, blank=True, null=True, related_name='given') | ||
amount = models.IntegerField(blank=False) | ||
title = models.CharField(max_length=100, blank=False) | ||
status = models.CharField(max_length=20, | ||
choices=STATUS, | ||
default="PENDING") | ||
note = models.CharField(max_length=256) | ||
phone = models.CharField( | ||
max_length=11, blank=True, null=True) | ||
fullname = models.CharField(max_length=100, blank=True, null=True) | ||
email = models.EmailField('email address') # Here | ||
|
||
class Meta: | ||
ordering = ('-created_at',) | ||
|
||
def __str__(self) -> str: | ||
return self.title |
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 @@ | ||
# django #selenium #webscraping | ||
from rest_framework import serializers | ||
from .models import Giving | ||
|
||
|
||
class GivingSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = Giving | ||
fields = '__all__' | ||
extra_kwargs = { | ||
'user': {'read_only': True}, | ||
} |
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. |
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 rest_framework.routers import DefaultRouter | ||
from django.urls import path, include | ||
from .views import GivingListCreateAPIView, GivingRetrieveAPIView, GivingUpdateAPIView, GivingDestroyAPIView | ||
|
||
urlpatterns = [ | ||
path('<uuid:pk>/', GivingRetrieveAPIView.as_view(), | ||
name="giving_detail"), | ||
path('<uuid:pk>/', GivingUpdateAPIView.as_view(), | ||
name="giving_update"), | ||
path('<uuid:pk>/', GivingDestroyAPIView.as_view(), | ||
name="giving_delete"), | ||
path('', GivingListCreateAPIView.as_view(), name="giving_list") | ||
] |
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,29 @@ | ||
from .models import Giving | ||
from .serializers import GivingSerializer | ||
from rest_framework import generics | ||
|
||
|
||
class GivingListCreateAPIView(generics.ListCreateAPIView): | ||
queryset = Giving.objects.all() | ||
serializer_class = GivingSerializer | ||
|
||
def perform_create(self, serializer): | ||
if self.request.user.is_authenticated: | ||
serializer.save(user=self.request.user) | ||
else: | ||
serializer.save() | ||
|
||
|
||
class GivingRetrieveAPIView(generics.RetrieveAPIView): | ||
queryset = Giving.objects.all() | ||
serializer_class = GivingSerializer | ||
|
||
|
||
class GivingUpdateAPIView(generics.UpdateAPIView): | ||
queryset = Giving.objects.all() | ||
serializer_class = GivingSerializer | ||
|
||
|
||
class GivingDestroyAPIView(generics.DestroyAPIView): | ||
queryset = Giving.objects.all() | ||
serializer_class = GivingSerializer |
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,2 +1,2 @@ | ||
QUESTION_TYPES = (("PRAYER_REQUEST", "PRAYER_REQUEST"), ("COUNSELLING", "COUNSELLING"), | ||
("OTHERS", "OTHERS"), ("WHISTLEBLOWING", "WHISTLEBLOWING"), ("SUGGESTION", "SUGGESTION")) | ||
("OTHERS", "OTHERS"), ("WHISTLEBLOWING", "WHISTLEBLOWING"), ("SUGGESTION", "SUGGESTION"), ("TESTIMONY", "TESTIMONY")) |
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,18 @@ | ||
# Generated by Django 4.0.8 on 2023-01-21 23:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('message', '0005_alter_message_fullname'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='message', | ||
name='message_type', | ||
field=models.CharField(choices=[('PRAYER_REQUEST', 'PRAYER_REQUEST'), ('COUNSELLING', 'COUNSELLING'), ('OTHERS', 'OTHERS'), ('WHISTLEBLOWING', 'WHISTLEBLOWING'), ('SUGGESTION', 'SUGGESTION'), ('TESTIMONY', 'TESTIMONY')], max_length=20), | ||
), | ||
] |
63 changes: 63 additions & 0 deletions
63
siteinfo/migrations/0002_alter_siteinfo_audio1_alter_siteinfo_audio2_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,63 @@ | ||
# Generated by Django 4.0.8 on 2023-01-21 23:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('siteinfo', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='audio1', | ||
field=models.FileField(blank=True, null=True, upload_to='audio/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='audio2', | ||
field=models.FileField(blank=True, null=True, upload_to='audio/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='audio3', | ||
field=models.FileField(blank=True, null=True, upload_to='audio/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='image2', | ||
field=models.ImageField(blank=True, null=True, upload_to='site/%Y/%m/%d/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='image3', | ||
field=models.ImageField(blank=True, null=True, upload_to='site/%Y/%m/%d/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='image4', | ||
field=models.ImageField(blank=True, null=True, upload_to='site/%Y/%m/%d/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='image5', | ||
field=models.ImageField(blank=True, null=True, upload_to='site/%Y/%m/%d/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='video1', | ||
field=models.FileField(blank=True, null=True, upload_to='videos/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='video2', | ||
field=models.FileField(blank=True, null=True, upload_to='videos/'), | ||
), | ||
migrations.AlterField( | ||
model_name='siteinfo', | ||
name='video3', | ||
field=models.FileField(blank=True, null=True, upload_to='videos/'), | ||
), | ||
] |