diff --git a/web/quotes/discordguild/adapter.py b/web/quotes/discordguild/adapter.py index b05b637139..f20286f596 100644 --- a/web/quotes/discordguild/adapter.py +++ b/web/quotes/discordguild/adapter.py @@ -9,7 +9,7 @@ class BFOBAdapter(DefaultAccountAdapter): class BFOBSocialAdapter(DefaultSocialAccountAdapter): - def is_open_for_signup(self, request): + def is_open_for_signup(self, request, sociallogin): return True def pre_social_login(self, request, sociallogin): diff --git a/web/quotes/quotedb/admin.py b/web/quotes/quotedb/admin.py index 45f35b9650..e08389fc80 100644 --- a/web/quotes/quotedb/admin.py +++ b/web/quotes/quotedb/admin.py @@ -2,5 +2,4 @@ from django.contrib import admin from . import models -admin.site.register(models.Person) admin.site.register(models.Quote) diff --git a/web/quotes/quotedb/migrations/0003_auto_20210120_2204.py b/web/quotes/quotedb/migrations/0003_auto_20210120_2204.py new file mode 100644 index 0000000000..915d717027 --- /dev/null +++ b/web/quotes/quotedb/migrations/0003_auto_20210120_2204.py @@ -0,0 +1,20 @@ +# Generated by Django 3.1.5 on 2021-01-20 22:04 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("quotedb", "0002_auto_20210120_0039"), + ] + + operations = [ + migrations.RemoveField( + model_name="quote", + name="references", + ), + migrations.DeleteModel( + name="Person", + ), + ] diff --git a/web/quotes/quotedb/models.py b/web/quotes/quotedb/models.py index 4a5cee9023..2df20279ce 100644 --- a/web/quotes/quotedb/models.py +++ b/web/quotes/quotedb/models.py @@ -4,24 +4,10 @@ from django.db import models from django.contrib.auth import models as auth_models -class Person(models.Model): - name = models.CharField(null=False, unique=True, blank=False, max_length=120) - user = models.ForeignKey( - auth_models.User, null=True, default=None, on_delete=models.SET_NULL - ) - - def __str__(self): - return self.name - - class Meta: - verbose_name_plural = "people" - - class Quote(models.Model): quote = models.TextField(null=False, blank=False) added_by = models.ForeignKey(auth_models.User, on_delete=models.SET_NULL, null=True) added_at = models.DateTimeField(default=datetime.datetime.now) - references = models.ManyToManyField(Person) def __str__(self): return self.quote diff --git a/web/quotes/quotedb/views.py b/web/quotes/quotedb/views.py index dedc1e5fc1..665db3b73c 100644 --- a/web/quotes/quotedb/views.py +++ b/web/quotes/quotedb/views.py @@ -1,5 +1,14 @@ from django.shortcuts import render +from . import models + def home(request): - return render(request, "quotedb/home.html", {}) + random_quote = models.Quote.objects.all().order_by("?").first() + return render( + request, + "quotedb/home.html", + { + "quote": random_quote, + }, + ) diff --git a/web/quotes/quotesapp/middleware.py b/web/quotes/quotesapp/middleware.py index 8e0c253955..f0f8ce1308 100644 --- a/web/quotes/quotesapp/middleware.py +++ b/web/quotes/quotesapp/middleware.py @@ -6,7 +6,7 @@ class LoginRequiredMiddleware: self.get_response = get_response def is_open_url(self, path_info): - return path_info.startswith('/accounts/') + return path_info.startswith("/accounts/") def __call__(self, request): if not self.is_open_url(request.path_info): diff --git a/web/quotes/quotesapp/settings.py b/web/quotes/quotesapp/settings.py index 1f75d59836..b89dbcb3bb 100644 --- a/web/quotes/quotesapp/settings.py +++ b/web/quotes/quotesapp/settings.py @@ -154,3 +154,6 @@ SOCIALACCOUNT_PROVIDERS = { ], }, } + +ACCOUNT_EMAIL_VERIFICATION = "none" +SOCIALACCOUNT_EMAIL_VERIFICATION = "none" diff --git a/web/quotes/quotesapp/urls.py b/web/quotes/quotesapp/urls.py index cf3439cde8..7b34c27603 100644 --- a/web/quotes/quotesapp/urls.py +++ b/web/quotes/quotesapp/urls.py @@ -24,6 +24,9 @@ import quotes.quotedb.urls urlpatterns = [ path("admin/", admin.site.urls), path("accounts/", include(allauth.urls)), - path("accounts/logged_out/", TemplateView.as_view(template_name='account/logged_out.html')), + path( + "accounts/logged_out/", + TemplateView.as_view(template_name="account/logged_out.html"), + ), re_path(r"", include(quotes.quotedb.urls)), ] diff --git a/web/quotes/templates/quotedb/_quote.html b/web/quotes/templates/quotedb/_quote.html new file mode 100644 index 0000000000..ab176cd33f --- /dev/null +++ b/web/quotes/templates/quotedb/_quote.html @@ -0,0 +1,4 @@ +
{{ quote.quote }}+