-
Notifications
You must be signed in to change notification settings - Fork 61
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
20 changed files
with
17 additions
and
257 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +0,0 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Referral | ||
|
||
|
||
@admin.register(Referral) | ||
class ReferralAdmin(admin.ModelAdmin): | ||
list_display = ("id", "referring_user", "status") | ||
list_filter = ("status",) | ||
raw_id_fields = ("referring_user",) | ||
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Generated by Django 5.1 on 2024-10-15 02:26 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("referrals", "0002_referral_email"), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name="Referral", | ||
), | ||
] |
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,19 +0,0 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from django.utils import timezone | ||
|
||
|
||
class Referral(models.Model): | ||
"""A referral allows customers to share School Desk with others""" | ||
|
||
class Status(models.IntegerChoices): | ||
PENDING = 1 | ||
SENT = 2 | ||
CONVERTED = 3 | ||
|
||
referring_user = models.ForeignKey( | ||
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="referrals" | ||
) | ||
email = models.EmailField() | ||
created_at = models.DateField(default=timezone.localdate) | ||
status = models.IntegerField(choices=Status.choices, default=Status.PENDING) | ||
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +0,0 @@ | ||
from denied.authorizers import any_authorized | ||
from denied.decorators import authorize | ||
from django.contrib import messages | ||
from django.http import HttpResponseRedirect | ||
from django.shortcuts import reverse | ||
from django.views.decorators.http import require_POST | ||
|
||
from .forms import ReferralForm | ||
|
||
|
||
@require_POST | ||
@authorize(any_authorized) | ||
def create_referral(request): | ||
"""Create a referral.""" | ||
email = request.POST.get("email", "missing email") | ||
data = {"email": email, "referring_user": request.user} | ||
form = ReferralForm(data=data) | ||
if form.is_valid(): | ||
form.save() | ||
messages.success(request, "We will message your friend shortly.") | ||
else: | ||
messages.error(request, f"'{email}' is an invalid email address.") | ||
return HttpResponseRedirect(reverse("settings:dashboard")) | ||
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
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