Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opt out user office from missed reservation notifications #265

Open
wants to merge 120 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
4ef837d
- starting 6.1.0.dev
rptmat57 Jun 18, 2024
f57e759
- completely removed dependency on pytz. plugins will have to require…
rptmat57 Jun 18, 2024
e9840fb
- fixed tests for python 3.8
rptmat57 Jun 18, 2024
e564433
Out of schedule email for areas.
r-xyz Jun 18, 2024
65c35f3
Remove non-relevant code for out-of-schedule email.
r-xyz Jun 19, 2024
41b9d73
Fix out-of-time email template.
r-xyz Jun 19, 2024
340f661
Merge pull request #243 from r-xyz/out-of-schedule-area-email
rptmat57 Jun 19, 2024
4d57493
Pickadate format based on py format (#242)
r-xyz Jun 19, 2024
45feacb
- added hybrid calendar feed for reservation and usage
rptmat57 Jun 20, 2024
ada833d
- made the required unanswered questions email into a customizable te…
rptmat57 Jun 20, 2024
e411b87
- now displaying UnitId/Bank/Multiplier in interlock names
rptmat57 Jun 21, 2024
39d9a69
- fixed template newline
rptmat57 Jun 21, 2024
258028e
- updated template wording
rptmat57 Jun 21, 2024
ae2912c
- in users page, now displaying projects using project selection temp…
rptmat57 Jun 27, 2024
9addf36
- updated Django version in classifiers
rptmat57 Jul 1, 2024
3bf968c
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Jul 1, 2024
f1a4015
- fixed wrong API filters for physical access levels
rptmat57 Jul 3, 2024
52b55c3
- Attempting to fix a bug with adjustment request reviewers not loadi…
rptmat57 Jul 5, 2024
8f8adc5
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Jul 5, 2024
5ffb7e0
- fixed a migration print statement
rptmat57 Jul 9, 2024
8c6dd73
Merge branch '6.1.0.dev' of github.com:usnistgov/NEMO into 6.1.0.dev
rptmat57 Jul 12, 2024
ab0e265
- updated Django to 4.2.14
rptmat57 Jul 12, 2024
7673521
- updated drf to 3.15.2
rptmat57 Jul 12, 2024
e77937f
- changed "facility usage" to "facility use"
rptmat57 Jul 26, 2024
fabc6da
- fixed ordering issue with configuration option for reservations
rptmat57 Jul 27, 2024
a47a795
- fixed adjustment requests link not working in email template
rptmat57 Aug 1, 2024
c365410
- in tool control data usage history tab, changed date label for pre-…
rptmat57 Aug 1, 2024
feeff7a
- fixed impersonate permission not working for anyone other than admins
rptmat57 Aug 6, 2024
68bfad2
Merge branch 'master' into 6.1.0.dev
rptmat57 Aug 22, 2024
c10220b
- removed pagination on readonly api endpoints to be consistent with …
rptmat57 Aug 27, 2024
c8db407
- removed links from footer for kiosk and area access pages
rptmat57 Aug 27, 2024
c5cb992
- added ability to customize farewell_screen for doors the same way w…
rptmat57 Aug 27, 2024
d30e136
- no need for calendar menu item when we have no tools and no areas
rptmat57 Sep 3, 2024
2ab9c93
Fixes #249.
r-xyz Sep 5, 2024
8f9e8af
Merge pull request #250 from r-xyz/landing-page-script-name-fix
rptmat57 Sep 5, 2024
34e8747
- removed dependency on distutils
rptmat57 Sep 5, 2024
12dc43d
- added serializer field for MultiEmailField in API
rptmat57 Sep 6, 2024
4a84b25
Add timeout to tool info tooltips in kiosk and status dashboard. (#251)
r-xyz Sep 6, 2024
45e6bab
- fixed a bug when NEMO would throw error 500 instead of return a bad…
rptmat57 Sep 6, 2024
d78c43e
Add reservation end date in kiosk.
r-xyz Sep 8, 2024
73a6824
- fixed max datetime issue
rptmat57 Sep 8, 2024
c59c6f1
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Sep 8, 2024
c7c154d
Merge pull request #254 from r-xyz/kiosk-reservation-end-date
rptmat57 Sep 9, 2024
50d26a4
- fixed tests still using old name for facility use feed in calendar
rptmat57 Sep 9, 2024
bdf41bb
- added new dynamic form question of type "radio_report_problem" to a…
rptmat57 Sep 10, 2024
42cb4da
- updated new pb reports to be sent to qualified users bcc
rptmat57 Sep 11, 2024
4a85a30
- fixed script_name messing up landing page choices when script name …
rptmat57 Sep 16, 2024
a0af3f4
- added request message for PostUsageRadioReportProblemQuestion (on s…
rptmat57 Sep 21, 2024
2613f5b
- finally fixed reservation policy issues when policy is off during w…
rptmat57 Sep 21, 2024
cbb59be
- now returning validation errors in broadcast email page when there …
rptmat57 Sep 26, 2024
fb6f61e
- now sending email with required questions when someone else forces …
rptmat57 Sep 26, 2024
44fec17
- update to tool usage counters
rptmat57 Sep 28, 2024
fe1c141
- added a way to mark charges as waived
rptmat57 Oct 4, 2024
35c0d81
- increased project name length to 1024
rptmat57 Oct 4, 2024
9b44eea
- separated adjustment request customization into its own section
rptmat57 Oct 4, 2024
b43cdc4
- missed renaming adjustment customizations in a few templates
rptmat57 Oct 4, 2024
85f591f
- removed restriction on changes for adjustment requests, meaning adj…
rptmat57 Oct 4, 2024
d4a8c04
-moved constants.py from views package to main package
rptmat57 Oct 5, 2024
e38f9e7
-moved constants.py from views package to main package
rptmat57 Oct 5, 2024
ab94c90
- updated api to include waive info for charges
rptmat57 Oct 5, 2024
e4929c9
- updated billing api to return username for validated_by and waived_by
rptmat57 Oct 5, 2024
195af92
- making sure validated_by and waived_by are always shown in api data
rptmat57 Oct 5, 2024
a745e27
- updated customizations_adjustment_requests.html to remove unnecessa…
rptmat57 Oct 5, 2024
e5e0cd3
- updated adjustment_request_notification_email to show the fact that…
rptmat57 Oct 5, 2024
267bd9a
- added a way to specify initial data in dynamic forms. this could be…
rptmat57 Oct 7, 2024
ca5258b
- fixed issue when initial data is empty in dynamic forms
rptmat57 Oct 7, 2024
0fdf42d
- added form_row and form_cell to dynamic form to set up a grid (from…
rptmat57 Oct 8, 2024
682da44
- fixed issue with max-width in dynamic form and improved the preview…
rptmat57 Oct 8, 2024
c4cd1bf
- using reservation title if set when sending ICS reservations emails
rptmat57 Oct 9, 2024
9b4e3bc
- added option to show username in tool freed time notification email
rptmat57 Oct 9, 2024
b2d34aa
- added pre-post run data in facility use details in calendar
rptmat57 Oct 11, 2024
fdbfdfe
- added pre-post run data in facility use details in calendar
rptmat57 Oct 11, 2024
0449875
- added operator information in usage data history
rptmat57 Oct 11, 2024
230e32c
- added customization setting to show tool documents in a separate ta…
rptmat57 Oct 11, 2024
bbbb64f
- added customization setting to only show qualified tools in kiosk
rptmat57 Oct 11, 2024
3399a3a
- fixed extend vs update issue with task recipients
rptmat57 Oct 11, 2024
92d7e60
- fixed issue with dynamic form grid not dealing with formulas correctly
rptmat57 Oct 14, 2024
8e991fb
- fixed adjustment requests tests
rptmat57 Oct 14, 2024
2301dfc
- added new datalist field to be used in admin for CharField and Choi…
rptmat57 Oct 14, 2024
95a5131
- added some type hints in utilities.py
rptmat57 Oct 14, 2024
1abb65a
- fixed last data point for sensor which was throwing an error when n…
rptmat57 Oct 14, 2024
923030b
- added constraints to prevent duplicate tool in use and duplicate us…
rptmat57 Oct 23, 2024
6b52eea
- added a customization to show who has a reservation next in tool co…
rptmat57 Oct 23, 2024
854cab3
- added new GUNICORN environment variables to customize its configura…
rptmat57 Oct 25, 2024
be58b41
- fixed strbool import in gunicorn_configuration
rptmat57 Oct 25, 2024
cb953eb
- added date for email logs in detailed admin
rptmat57 Oct 28, 2024
1ce8d3f
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Oct 28, 2024
b5e9ea0
- fixed type hint for slugify method in utilities.py
rptmat57 Oct 28, 2024
ac5bfbf
- added PIs to project view in detailed administration
rptmat57 Oct 28, 2024
3a17a51
- added new type of AdminEmailHandler for django allowing to limit th…
rptmat57 Oct 31, 2024
2919a1b
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Oct 31, 2024
9d31b03
- fixed validate_unique for usage events and area access records thro…
rptmat57 Nov 3, 2024
069a54e
- added new options to use a tool for training in tool control. only …
rptmat57 Nov 3, 2024
53cbc08
- fixed tests
rptmat57 Nov 4, 2024
e42bd53
- fixed landing page URL field
rptmat57 Nov 8, 2024
eb9fb65
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Nov 8, 2024
74a8957
- added apps.py for all internal plugins
rptmat57 Nov 8, 2024
7afaa31
- added new environment variable NEMO_EXTRA_PIP_PACKAGES to easily in…
rptmat57 Nov 8, 2024
700060b
- added better handling when loading plugin URLs
rptmat57 Nov 8, 2024
360185d
- added index on sensor data created date to speed up "latest data po…
rptmat57 Nov 9, 2024
fd04cd5
- fixed @synchronized annotation which prevents users from enabling/d…
rptmat57 Nov 10, 2024
b8a56b6
- fixed tests
rptmat57 Nov 10, 2024
e15dafc
- simplified lock_name in synchronized decorator
rptmat57 Nov 10, 2024
5ec7911
- added customization option to automatically shut down a tool when a…
rptmat57 Nov 11, 2024
a600c3c
- added ordering by name for sensors
rptmat57 Nov 11, 2024
b265963
- optimized sensor loading in admin and in dashboard by recording the…
rptmat57 Nov 11, 2024
44c7a10
- changed wording in record training page
rptmat57 Nov 12, 2024
d246129
- added json dictionary of extra arguments for sensor and interlock c…
rptmat57 Nov 13, 2024
ce0e44f
- added support for timeout in all interlock implementations
rptmat57 Nov 13, 2024
527dea9
- dropped support for python 3.8 and added support for python 3.13
rptmat57 Nov 13, 2024
2481232
Kiosk improve highlighting in reservations questions (#260)
r-xyz Nov 20, 2024
59706b3
- added utils.py for plugin utility functions
rptmat57 Nov 21, 2024
bff7cff
- added utils.py for plugin utility functions
rptmat57 Nov 22, 2024
2b6d981
- created new autocomplete widget for admin fields allowing select2 a…
rptmat57 Nov 22, 2024
14b9d9b
Merge remote-tracking branch 'origin/6.1.0.dev' into 6.1.0.dev
rptmat57 Nov 22, 2024
e897d22
- added a way to enable/disable reservation questions
rptmat57 Dec 6, 2024
9c7110d
- added utility function to dynamically add new notification types to…
rptmat57 Dec 6, 2024
e8e014e
Add `user_documents` to API. (#263)
r-xyz Dec 11, 2024
15b5d13
- added more filters for user documents api endpoint
rptmat57 Dec 11, 2024
25d2964
- added new policy checks to make sure the policy is checked when the…
rptmat57 Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ RUN mkdir /nemo
WORKDIR /nemo
ENV DJANGO_SETTINGS_MODULE "settings"
ENV PYTHONPATH "/nemo/"

# Gunicorn config options
ENV GUNICORN_WORKER_CLASS ""
ENV GUNICORN_WORKER_COUNT ""
ENV GUNICORN_THREAD_COUNT ""
ENV GUNICORN_KEEPALIVE_SECONDS ""
ENV GUNICORN_CAPTURE_OUTPUT ""

# NEMO extra python packages
ENV NEMO_EXTRA_PIP_PACKAGES ""

COPY gunicorn_configuration.py /etc/

EXPOSE 8000/tcp
Expand Down
8 changes: 8 additions & 0 deletions NEMO/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.urls import reverse
from django.utils.safestring import mark_safe

from NEMO.mixins import BillableItemMixin
from NEMO.models import Area, Configuration, Interlock, InterlockCard, Tool, User
from NEMO.typing import QuerySetType
from NEMO.utilities import new_model_copy
Expand Down Expand Up @@ -176,3 +177,10 @@ def duplicate_configuration(model_admin, request, queryset: QuerySetType[Configu
messages.error(
request, f"{original_name} could not be duplicated because of the following error: {str(error)}"
)


@admin.action(description="Waive selected charges")
def waive_selected_charges(model_admin, request, queryset: QuerySetType[BillableItemMixin]):
for charge in queryset:
charge.waive(request.user)
messages.success(request, f"{model_admin.model.__name__} #{charge.id} has been successfully waived")
76 changes: 64 additions & 12 deletions NEMO/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
rebuild_area_tree,
synchronize_with_tool_usage,
unlock_selected_interlocks,
waive_selected_charges,
)
from NEMO.forms import BuddyRequestForm, RecurringConsumableChargeForm, UserPreferencesForm
from NEMO.mixins import ModelAdminRedirectMixin, ObjPermissionAdminMixin
Expand Down Expand Up @@ -475,7 +476,18 @@ def save_model(self, request, obj: Area, form, change):

@register(TrainingSession)
class TrainingSessionAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin, admin.ModelAdmin):
list_display = ("id", "trainer", "trainee", "tool", "project", "type", "date", "duration", "qualified")
list_display = (
"id",
"trainer",
"trainee",
"tool",
"project",
"type",
"date",
"duration",
"qualified",
"usage_event",
)
list_filter = (
"qualified",
"date",
Expand All @@ -486,7 +498,8 @@ class TrainingSessionAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin, adm
("trainee", admin.RelatedOnlyFieldListFilter),
)
date_hierarchy = "date"
autocomplete_fields = ["trainer", "trainee", "tool", "project", "validated_by"]
autocomplete_fields = ["trainer", "trainee", "tool", "project", "validated_by", "waived_by"]
actions = [waive_selected_charges]

def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""We only want staff user and tool superusers to be possible trainers"""
Expand All @@ -504,15 +517,17 @@ class StaffChargeAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin, admin.M
("staff_member", admin.RelatedOnlyFieldListFilter),
)
date_hierarchy = "start"
autocomplete_fields = ["staff_member", "customer", "project", "validated_by"]
autocomplete_fields = ["staff_member", "customer", "project", "validated_by", "waived_by"]
actions = [waive_selected_charges]


@register(AreaAccessRecord)
class AreaAccessRecordAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin, admin.ModelAdmin):
list_display = ("id", "customer", "area", "project", "start", "end")
list_filter = (("area", TreeRelatedFieldListFilter), "start")
date_hierarchy = "start"
autocomplete_fields = ["customer", "project", "validated_by"]
autocomplete_fields = ["customer", "project", "validated_by", "waived_by"]
actions = [waive_selected_charges]


@register(Configuration)
Expand Down Expand Up @@ -590,10 +605,15 @@ class ProjectDocumentsInline(DocumentModelAdmin):

@register(Project)
class ProjectAdmin(admin.ModelAdmin):
list_display = ("name", "id", "get_application_identifier", "account", "active", "start_date")
list_display = ("name", "id", "get_application_identifier", "account", "active", "get_managers", "start_date")
filter_horizontal = ("only_allow_tools",)
search_fields = ("name", "application_identifier", "account__name")
list_filter = ("active", ("account", admin.RelatedOnlyFieldListFilter), "start_date")
list_filter = (
"active",
("account", admin.RelatedOnlyFieldListFilter),
"start_date",
("manager_set", admin.RelatedOnlyFieldListFilter),
)
inlines = [ProjectDocumentsInline]
form = ProjectAdminForm
autocomplete_fields = ["account"]
Expand All @@ -602,6 +622,10 @@ class ProjectAdmin(admin.ModelAdmin):
def get_application_identifier(self, project: Project):
return project.application_identifier

@display(description="PIs", ordering="manager_set")
def get_managers(self, project: Project):
return mark_safe("<br>".join([pi.get_name() for pi in project.manager_set.all()]))

def save_model(self, request, obj, form, change):
"""
Audit project creation and modification. Also save any project membership changes explicitly.
Expand Down Expand Up @@ -667,7 +691,8 @@ class ReservationAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin, admin.M
)
date_hierarchy = "start"
inlines = [ConfigurationOptionInline]
autocomplete_fields = ["user", "creator", "tool", "project", "cancelled_by", "validated_by"]
autocomplete_fields = ["user", "creator", "tool", "project", "cancelled_by", "validated_by", "waived_by"]
actions = [waive_selected_charges]


class ReservationQuestionsForm(forms.ModelForm):
Expand Down Expand Up @@ -718,11 +743,14 @@ class ReservationQuestionsAdmin(admin.ModelAdmin):
form = ReservationQuestionsForm
filter_horizontal = ("only_for_tools", "only_for_areas", "only_for_projects")
readonly_fields = ("questions_preview",)
list_filter = ["enabled", "tool_reservations", "area_reservations"]
list_display = ["name", "enabled", "tool_reservations", "area_reservations"]
fieldsets = (
(
None,
{
"fields": (
"enabled",
"name",
"questions",
"questions_preview",
Expand All @@ -743,9 +771,10 @@ def questions_preview(self, obj):
@register(UsageEvent)
class UsageEventAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin, admin.ModelAdmin):
list_display = ("id", "tool", "user", "operator", "project", "start", "end", "duration", "remote_work")
list_filter = ("remote_work", "start", "end", ("tool", admin.RelatedOnlyFieldListFilter))
list_filter = ("remote_work", "training", "start", "end", ("tool", admin.RelatedOnlyFieldListFilter))
date_hierarchy = "start"
autocomplete_fields = ["tool", "user", "operator", "project", "validated_by"]
autocomplete_fields = ["tool", "user", "operator", "project", "validated_by", "waived_by"]
actions = [waive_selected_charges]


@register(Consumable)
Expand Down Expand Up @@ -777,7 +806,8 @@ class ConsumableWithdrawAdmin(ObjPermissionAdminMixin, ModelAdminRedirectMixin,
list_display = ("id", "customer", "merchant", "consumable", "quantity", "project", "date")
list_filter = ("date", ("consumable", admin.RelatedOnlyFieldListFilter))
date_hierarchy = "date"
autocomplete_fields = ["customer", "merchant", "consumable", "project", "validated_by"]
autocomplete_fields = ["customer", "merchant", "consumable", "project", "validated_by", "waived_by"]
actions = [waive_selected_charges]


@register(RecurringConsumableCharge)
Expand All @@ -798,6 +828,14 @@ class Meta:
widgets = {"password": forms.PasswordInput(render_value=True)}
fields = "__all__"

def clean_extra_args(self):
extra_args = self.cleaned_data["extra_args"]
try:
return json.dumps(json.loads(extra_args), indent=4)
except:
pass
return extra_args

def clean(self):
if any(self.errors):
return
Expand Down Expand Up @@ -1667,11 +1705,21 @@ class ToolUsageCounterAdmin(admin.ModelAdmin):
"tool_usage_question",
"value",
"warning_threshold",
"default_value",
"staff_members_can_reset",
"qualified_users_can_reset",
"superusers_can_reset",
"last_reset",
"last_reset_by",
"is_active",
)
list_filter = (("tool", admin.RelatedOnlyFieldListFilter), "last_reset")
list_filter = (
"staff_members_can_reset",
"qualified_users_can_reset",
"superusers_can_reset",
("tool", admin.RelatedOnlyFieldListFilter),
"last_reset",
)
readonly_fields = ("warning_threshold_reached",)
form = ToolUsageCounterAdminForm
autocomplete_fields = ["tool", "last_reset_by"]
Expand Down Expand Up @@ -1723,6 +1771,7 @@ class AdjustmentRequestAdmin(admin.ModelAdmin):
)
date_hierarchy = "last_updated"
actions = [adjustment_requests_export_csv, adjustment_requests_mark_as_applied]
readonly_fields = ["creation_time"]

@admin.display(description="Diff")
def get_time_difference(self, adjustment_request: AdjustmentRequest):
Expand Down Expand Up @@ -1866,7 +1915,10 @@ class EmailLogAdmin(admin.ModelAdmin):
list_display = ["id", "category", "sender", "to", "subject", "when", "ok"]
list_filter = ["category", "ok"]
search_fields = ["subject", "content", "to"]
readonly_fields = ("content_preview",)
readonly_fields = (
"when",
"content_preview",
)
date_hierarchy = "when"

def content_preview(self, obj):
Expand Down
11 changes: 11 additions & 0 deletions NEMO/apps/area_access/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.apps import AppConfig


class AreaAccessConfig(AppConfig):
name = "NEMO.apps.area_access"

def ready(self):
"""
This code will be run when Django starts.
"""
pass
2 changes: 1 addition & 1 deletion NEMO/apps/area_access/templates/area_access/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1 style="color:lightgrey" id="badge_number"></h1>
</div>
<div id="countdown" class="countdown" style="position: fixed; bottom: 0; right: 0;font-size: x-large"></div>
</div>
{% include 'base/footer.html' %}
{% include 'base/footer.html' with no_links=True %}
<script type="text/javascript">
{% with show_badge_number="application"|customization:"show_badge_number" %}
let area_access_badge_reader = new BadgeReader(send_badge_number, "{{ badge_reader.send_key }}", {% if badge_reader.record_key %}"{{ badge_reader.record_key }}",{% else %}undefined,{% endif %} {{ show_badge_number|yesno:"true,false" }});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% extends 'area_access/base.html' %}
{% block title %}Farewell{% endblock %}
{% block default_content %}<h1>Scan your badge to log out.</h1>{% endblock %}
{% block default_content %}
{{ door.farewell_message|default_if_none:"<h1>Scan your badge to log out.</h1>"|safe }}
{% endblock %}
{% block action %}exit_area(badge_number);{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% extends 'area_access/base.html' %}
{% block title %}Welcome{% endblock %}
{% block default_content %}{{ door.welcome_message|safe }}{% endblock %}
{% block default_content %}
{{ door.welcome_message|default_if_none:"<h1>Scan your badge to log in.</h1>"|safe }}
{% endblock %}
{% block action %}enter_area(badge_number, undefined);{% endblock %}
6 changes: 5 additions & 1 deletion NEMO/apps/area_access/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from time import sleep

from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import ValidationError
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, render
from django.template.defaultfilters import linebreaksbr
Expand Down Expand Up @@ -243,7 +244,10 @@ def login_to_area(request, door_id):

delay_lock_door(door.id)

log_in_user_to_area(area, user, project)
try:
log_in_user_to_area(area, user, project)
except ValidationError as e:
return render(request, "area_access/physical_access_denied.html", {"message": str(e)})

dictionary = {
"door": door,
Expand Down
1 change: 1 addition & 0 deletions NEMO/apps/contracts/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class ContractsConfig(AppConfig):
name = "NEMO.apps.contracts"
label = "contracts"

def ready(self):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.2.15 on 2024-10-04 03:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("contracts", "0004_default_display_order"),
]

operations = [
migrations.AlterField(
model_name="contractoragreementdocuments",
name="name",
field=models.CharField(
blank=True, help_text="The optional name to display for this document", max_length=255, null=True
),
),
migrations.AlterField(
model_name="contractoragreementdocuments",
name="url",
field=models.URLField(blank=True, null=True, verbose_name="URL"),
),
migrations.AlterField(
model_name="procurementdocuments",
name="name",
field=models.CharField(
blank=True, help_text="The optional name to display for this document", max_length=255, null=True
),
),
migrations.AlterField(
model_name="procurementdocuments",
name="url",
field=models.URLField(blank=True, null=True, verbose_name="URL"),
),
]
10 changes: 5 additions & 5 deletions NEMO/apps/contracts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
from django.utils.translation import gettext_lazy as _

from NEMO.apps.contracts.customization import ContractsCustomization
from NEMO.constants import CHAR_FIELD_MEDIUM_LENGTH, MEDIA_PROTECTED
from NEMO.models import BaseDocumentModel, BaseModel, User
from NEMO.views.constants import CHAR_FIELD_MAXIMUM_LENGTH, MEDIA_PROTECTED


class Procurement(BaseModel):
name = models.CharField(max_length=CHAR_FIELD_MAXIMUM_LENGTH, help_text=_("The name of the contract"))
name = models.CharField(max_length=CHAR_FIELD_MEDIUM_LENGTH, help_text=_("The name of the contract"))
submitted_date = models.DateField(null=True, blank=True, help_text=_("The date this contract was submitted"))
award_date = models.DateField(null=True, blank=True, help_text=_("The date this contract was awarded"))
contract_number = models.CharField(
null=True, blank=True, max_length=CHAR_FIELD_MAXIMUM_LENGTH, help_text=_("The contract number")
null=True, blank=True, max_length=CHAR_FIELD_MEDIUM_LENGTH, help_text=_("The contract number")
)
requisition_number = models.CharField(
null=True,
blank=True,
max_length=CHAR_FIELD_MAXIMUM_LENGTH,
max_length=CHAR_FIELD_MEDIUM_LENGTH,
help_text=_("The requisition number for this contract"),
)
cost = models.DecimalField(
Expand Down Expand Up @@ -76,7 +76,7 @@ def clean(self):


class ContractorAgreement(BaseModel):
name = models.CharField(max_length=CHAR_FIELD_MAXIMUM_LENGTH, help_text=_("The name of the contractor"))
name = models.CharField(max_length=CHAR_FIELD_MEDIUM_LENGTH, help_text=_("The name of the contractor"))
contract = models.ForeignKey(
Procurement,
null=True,
Expand Down
11 changes: 11 additions & 0 deletions NEMO/apps/kiosk/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.apps import AppConfig


class KioskConfig(AppConfig):
name = "NEMO.apps.kiosk"

def ready(self):
"""
This code will be run when Django starts.
"""
pass
Loading