Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanjbrown committed Apr 17, 2024
1 parent de99026 commit 9069857
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
1 change: 1 addition & 0 deletions consultation_analyser/authentication/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin
from django.contrib.auth.models import Group

from .models import User

# leave this out until we know what we’re doing with Groups etc
Expand Down
2 changes: 1 addition & 1 deletion consultation_analyser/consultations/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin
from waffle.models import Flag, Sample
from magic_link.models import MagicLink, MagicLinkUse
from waffle.models import Flag, Sample

admin.site.site_header = "Consultation analyser admin panel"

Expand Down
3 changes: 1 addition & 2 deletions consultation_analyser/consultations/forms/sessions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django import forms

from crispy_forms_gds.helper import FormHelper
from crispy_forms_gds.layout import Button, Layout
from django import forms


class NewSessionForm(forms.Form):
Expand Down
4 changes: 2 additions & 2 deletions consultation_analyser/consultations/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.urls import path, include
from django.urls import include, path
from magic_link import urls as magic_link_urls

from .views import consultations, pages, questions, responses, schema, sessions
from magic_link import urls as magic_link_urls

urlpatterns = [
path("", pages.home),
Expand Down
13 changes: 5 additions & 8 deletions consultation_analyser/consultations/views/sessions.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from django.http import HttpRequest
from django.shortcuts import render, get_object_or_404
from django.contrib.auth import logout
from django.shortcuts import redirect
from django.contrib import messages
from django.contrib.auth import logout
from django.http import HttpRequest
from django.shortcuts import get_object_or_404, redirect, render
from magic_link.models import MagicLink
from waffle.decorators import waffle_switch

from consultation_analyser.authentication.models import User
from magic_link.models import MagicLink


from consultation_analyser.consultations.forms.sessions import NewSessionForm


Expand All @@ -21,7 +18,7 @@ def get_magic_link_for_email(request: HttpRequest, email: str) -> str:
return ""


@waffle_switch('FRONTEND_USER_LOGIN')
@waffle_switch("FRONTEND_USER_LOGIN")
def new(request: HttpRequest):
if not request.POST:
form = NewSessionForm()
Expand Down
36 changes: 18 additions & 18 deletions consultation_analyser/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass
import waffle

import waffle
from django.http import HttpRequest


Expand All @@ -24,31 +24,31 @@ def app_config(request: HttpRequest):
],
)
else:
menu_items=[
menu_items = [
{
"href": "/schema",
"text": "Data schema",
"active": request.path == "/schema",
}
]

if waffle.switch_is_active('FRONTEND_USER_LOGIN'):
if waffle.switch_is_active("FRONTEND_USER_LOGIN"):
if request.user.is_authenticated:
menu_items.append({
"href": "/sign-out",
"text": "Sign out",
})
menu_items.append(
{
"href": "/sign-out",
"text": "Sign out",
}
)
else:
menu_items.append({
"href": "/sign-in",
"text": "Sign in",
"active": request.path == "/sign-in/",
})

app_config = AppConfig(
name="Consultation analyser",
path="/",
menu_items=menu_items
)
menu_items.append(
{
"href": "/sign-in",
"text": "Sign in",
"active": request.path == "/sign-in/",
}
)

app_config = AppConfig(name="Consultation analyser", path="/", menu_items=menu_items)

return {"app_config": app_config}
2 changes: 1 addition & 1 deletion consultation_analyser/jinja2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jinja2
from compressor.contrib.jinja2ext import CompressorExtension
from django.templatetags.static import static
from django.template.loader import render_to_string
from django.templatetags.static import static
from django.urls import reverse
from jinja2 import ChoiceLoader, Environment, PackageLoader, PrefixLoader

Expand Down

0 comments on commit 9069857

Please sign in to comment.