Skip to content

Commit

Permalink
Merge of new UBCCR features; lints, refactors, and test improvements (#…
Browse files Browse the repository at this point in the history
…220)

* various minor bugfixes ( no longer says "removed 1 users", help button only appears if user adds center url, naming typo in xdmod, Fixed force_overwrite argument.)
* Remove test fixtures and replace with Factory-based testing
* Change ProjectUserMessage model to align more closely to AllocationUserNote
* documentation improvements

* allocation and resource attribute listings sorted CI alpha

* Tested Django querying and reverse related object lookup for revamp implementation

* child resources sorted CI

* email revamp

* Commit before to allow changes from master to be pulled and merged

* Updated attach allocation links to projects and when they are expiring

* Added resource parent name to each allocation that is expiring or expired. Finished implementation of sending emails for expired allocations

* First attempt at adding email notifications on expired allocations for center staff

* Updated admin emails

* Add partial match for attribute search ICM#306

* Add AccHr and Storage metrics import from XDMoD

* Add GPUh support for XDMOD synchronisation

* Arguments in signal def are obsolete

* allocation/ resource attribute lists sorted CI

* make migrations to sort lists

* migrations edited for sorting CI

* button now displays "Activate" without attributes

* Bump Django and other dependency versions

* Fix alignment

* Fix up center help url

* Serve css/js assets locally instead of cdn.

* Add ColdFront logo and branding
* sort lists CI on front end

* flatpickr added, formatting for form control fixed

* Switch to LDAP lookup for nsaccountlock in freeipa.

* delete extra commented portion

* deleted jqueryui,  BG color changed via common.css

* Changes to allocation attribute types, global config for admin emails, adjusted admin email template, and updated docs.

* grant funding agencies sorted alphabetically

* Include allocations in 'pending renewal' status.

Fixes #176

* Updates to admin email template and logic, reverted allocation attribute name change, performed final testing.

* Adjust email receiver for admin emails

* Removed unused imports

* Changes to expiring email subject and first line

* Fixed description not displaying when setting value before Approving allocation request.

* Fixed case where user could enter just start_date. Before the website would crash, now the dates are automatically applied instead.

* Refactor allocation emails.

- Move email helper functions to utils
- Remove uncessary checks for EMAIL_ENABLED
- Use fstrings instead .format

* Added warning and choice to run initial_setup script.

* Added sorting to username, first name, last name, email, and status for project detail page

* Added user sorting on allocation detail page

* Pin importlib-metadata

* Reconstructed PR#450

* Made adjustments according to PR review

* Adjusted adding project attributes scripts

* Added argument to force setup_script and adjusted logic of script.

* Put call_command into its own function

* Updates to how we handle inputted dates

* Updated color of deny button

* Updates to warning script and short cut for argument

* Update models.py

This was preventing edits in DjangoAdmin - its ok have unique attribute in form as long as it is the existing one.

* Fix bug in init script

* changes to __str__ methods in hopes of reducing load times

* Refactor allocation approval.

This commit refactors the allocation approval logic in the following
ways:

1. Removes the AllocationActivateRequestView and
   AllocationDenyRequestView. These views are currently handled via GET
   requests and because they modify the database they really should be
   POST requests. The logic in these views is also a duplicate of what
   is already contained in the AllocationDetailView.

2. Modify AllocationDetailView to handle the various actions of
   update, approve, auto-approve and deny allocations. These are defined
   as follows:

   - update = user clicks the "update" button on the allocation detail
     page with the intent of updating the allocation data.

   - approve = user clicks the "approve" button on the allocation detail
     page. In addition to updating the allocation data this will set the
     status to "Active" and set the end date equal to now + ALLOCATION_DEFAULT_ALLOCATION_LENGTH days
     This also properly fixes ubccr#433.

   - auto-approve = user clicks the "approve" button from the allocation
     request list page. This will set the status to "Active" and set the end date equal to
     now + ALLOCATION_DEFAULT_ALLOCATION_LENGTH days. It will not update
     any other data on the allocation.

   - deny = user clicks the "deny" button on the allocation detail page.
     This will set the status to "Denied" and remove the start/end
     dates.

3. On the allocation request list page, the "approve" button now submits
   a POST request instead of a get request to "auto-approve" the
   allocation (see above logic). Also the button label has been changed
   to "Approve" to be consistent with the allocation detail page.

* Bump dep versions

* Add mkdocstring plugin for generating API docs.

* Add coldfront

* Remove

* Add configs to install coldfront

* Remove

* set python version

* Adjust python version

* Add os back

* Add core model classes to api docs

* Fix version

* Fix logic in allocation change request flow.

- Remove activate/deny GET request views for change requests
- Fix bug when setting end_date_extension

* changes to signal and email logic for allocations

* Adjust first_name max length

* Update views.py

changed references to allocation_obj.status to allocation_obj.status.name

* Update allocation_revoked.txt

* started

* start

* Fix url not displaying in emails

* Formatting fix

* Allow configuration of session timeout.

Add config option for setting a session inactivity timeout. This value
sets the session cookie age. We also save the session on each request
which will update the session cookie age on each click. This commit
fixes ubccr#452.

* improved navigation (idea credit: @aebruno)

* resource and user models have base docs

* Update docs and add links to changelogs

* removed source code dropdown and added to user docs
* added field of science, grant, publication, and research output models

* Updates and reorganization to documentation

* Add docs on importing project/allocation users

* Minor code cleanup

* updated directory name of importing file

* reorg and update of documentation

* refactor complex list views

* refactor note sections on detail pages to use templates

* add notes to department models and views

* change allocation and project note creation to use generic template

* update testing suite for model changes; add Factory-based tests to Project

* fix button presentation for allocation_change_list

* add kwargs to refactored note create views

* add note update capability

* add more project tests, fix ProjectDetail template

* change allocationlist to display allocations user belongs to regardless of project membership

* move fasrc hook out of views file and into utils

* change fixtures in preparation for replacement, replace fixtures with factories in allocation tests

* fix list_view path url

* add user_cannot_access test_helper function

* add project title to projectlist search

* make project addition button visible only to admins

* make projectcreation accessible only to superusers

* make project invoice chart only visible if it contains data

* enable project_create_form visibility

* make presence of department menu options dependent on installation status of app

* minor linting/reformatting

* pi has project permission even if pi has no ProjectUser entry

* allocationuser has allocation viewing permission even if not a projectuser

* hide Add Attribute button from non-admin users including PIs

* change name of projectusermessage message in admin view

* update archived project list template

* change allocation request button text

* add tests for ProjectDetail and archived project Views

* add UI element permissions

* add warning about inactive/denied allocations

* remove clashing datatables css reference

* reduce length of Notification Enabled header text

* make single function for creation of test data, add more tests

* nese data processing

* start using Factories in Department tests

* remove commented-out code from templates

* correct logging path

* replace plugin test fixtures with factories

* replace fixtures with factory in sftocf; remove test fixtures

* add allocationchangestatuschoices to test data setup

* change path to look for subdirectory attr name instead of ID

---------

Co-authored-by: rg663 <74742605+rg663@users.noreply.github.com>
Co-authored-by: Andrew Stoltman <aestoltm@buffalo.edu>
Co-authored-by: mdzik <mdzik@icm.edu.pl>
Co-authored-by: Andrew E. Bruno <aebruno2@buffalo.edu>
Co-authored-by: mdzik <dziki01@gmail.com>
Co-authored-by: Dori Sajdak <djm29@buffalo.edu>
Co-authored-by: ShreyasSridhar24 <ss649@buffalo.edu>
  • Loading branch information
8 people authored May 22, 2023
2 parents f9fd4d6 + 0be683c commit e5a06fb
Show file tree
Hide file tree
Showing 228 changed files with 6,700 additions and 4,432 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ coldfront.db-journal
django-q.log
*.csv
media/reports*
.devcontainer/*
.bin/*
9 changes: 8 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.9"

# Build documentation with MkDocs
mkdocs:
configuration: docs/mkdocs.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
path: .
39 changes: 38 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# ColdFront Changelog

## [1.1.4] - 2023-02-11

- Datepicker changed to flatpickr. Remove jquery-ui [#438](https://github.com/ubccr/coldfront/issues/438)
- Combined email expiry notifications [#413](https://github.com/ubccr/coldfront/pull/413)
- Remove obsolete arguments in signal defs [#422](https://github.com/ubccr/coldfront/pull/422)
- Allow sorting of users on detail page [#408](https://github.com/ubccr/coldfront/issues/408)
- Fix approve button deleting description text [#433](https://github.com/ubccr/coldfront/issues/433)
- Add Project Attributes [#466](https://github.com/ubccr/coldfront/pull/466)
- Slurm plugin: fix allocations in pending renewal status [#176](https://github.com/ubccr/coldfront/issues/176)
- Update list displayes to sort case insensitive throughout front end [#393](https://github.com/ubccr/coldfront/issues/393)
- Fix FreeIPA plugin not recognizing usernames greater than 11 characters [#416](https://github.com/ubccr/coldfront/issues/416)
- Send signal if allocation status is revoked [#474](https://github.com/ubccr/coldfront/issues/474)
- Upgrade to Django 3.2.17
- Allow configuration of session timeout [#452](https://github.com/ubccr/coldfront/issues/452)
- Increase max length for user first_name [#490](https://github.com/ubccr/coldfront/pull/490)

## [1.1.3] - 2022-07-07

- Fix erronous allocation change request error message [#428](https://github.com/ubccr/coldfront/issues/428)
- Upgrade bootstrap and move to static assets [#405](https://github.com/ubccr/coldfront/issues/405)
- Allow changes on allocations in the test dataset
- Add new ColdFront logos and branding [#431](https://github.com/ubccr/coldfront/pull/431)

## [1.1.2] - 2022-07-06

- Fix "Select all" toggle for allocations [#396](https://github.com/ubccr/coldfront/issues/396)
- Fixed allocation expiration task bug [#401](https://github.com/ubccr/coldfront/pull/401)
- Fix new user sorting [#395](https://github.com/ubccr/coldfront/issues/395)
- Fix allocation approved status [#379](https://github.com/ubccr/coldfront/issues/379)
- Add notes on project detail page [#194](https://github.com/ubccr/coldfront/issues/194)
- Add partial match for attribute search [#421](https://github.com/ubccr/coldfront/pull/421)
- Fix miscellaneous config issues [#414](https://github.com/ubccr/coldfront/issues/414)
- Upgrade to Django 3.2.14

## [1.1.1] - 2022-04-26

- Fix grant export to only download those found under search [#222](https://github.com/ubccr/coldfront/issues/222)
Expand Down Expand Up @@ -89,4 +123,7 @@
[1.0.4]: https://github.com/ubccr/coldfront/releases/tag/v1.0.4
[1.1.0]: https://github.com/ubccr/coldfront/releases/tag/v1.1.0
[1.1.1]: https://github.com/ubccr/coldfront/releases/tag/v1.1.1
[Unreleased]: https://github.com/ubccr/coldfront/compare/v1.1.1...HEAD
[1.1.2]: https://github.com/ubccr/coldfront/releases/tag/v1.1.2
[1.1.3]: https://github.com/ubccr/coldfront/releases/tag/v1.1.3
[1.1.4]: https://github.com/ubccr/coldfront/releases/tag/v1.1.4
[Unreleased]: https://github.com/ubccr/coldfront/compare/v1.1.4...HEAD
3 changes: 1 addition & 2 deletions Dockerfile-ifx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:experimental
FROM python:3.6
FROM python:3.8

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -24,7 +24,6 @@ ARG IFXEC_COMMIT=0c09c90890fb87d4db22c635a6c403c89e1a957f
ARG IFXBILLING_COMMIT=58d07688e52b4c63fb93a903cbb8a1e5ed24ea34

RUN --mount=type=ssh pip install --upgrade pip && \
pip install 'Django>3,<4' && \
pip install django-author==1.0.2 && \
pip install git+ssh://git@github.com/harvardinformatics/ifxurls.git@${IFXURLS_COMMIT} && \
pip install git+ssh://git@github.com/harvardinformatics/nanites.client.git@${NANITES_CLIENT_COMMIT} && \
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
![ColdFront](docs/pages/images/logo-lg.png)

# ColdFront - Resource Allocation System

[![Documentation Status](https://readthedocs.org/projects/coldfront/badge/?version=latest)](https://coldfront.readthedocs.io/en/latest/?badge=latest)

ColdFront is an open source resource allocation system designed to provide a
ColdFront is an open source resource and allocation management system designed to provide a
central portal for administration, reporting, and measuring scientific impact
of HPC resources. ColdFront was created to help HPC centers manage access to a
diverse set of resources across large groups of users and provide a rich set of
extensible meta data for comprehensive reporting. ColdFront is written in
Python and released under the GPLv3 license.
of cyberinfrastructure resources. ColdFront was created to help high performance computing (HPC) centers manage access to a diverse set of resources across large groups of users and provide a rich set of
extensible meta data for comprehensive reporting. The flexiblity of ColdFront allows centers to manage and automate their policies and procedures within the framework provided or extend the functionality with [plugins](docs/pages/index.md#extensibility). ColdFront is written in Python and released under the GPLv3 license.

## Features

- Allocation based system for managing access to resources
- Collect Project, Grant, and Publication data from users
- Define custom attributes on resources and allocations
- Self-service portal for users to request access to resources for their research group
- Collection of Project, Grant, and Publication data from users
- Center director approval system and annual project review process
- Email notifications for expiring/renewing access to resources
- Integration with 3rd party systems for automation and access control
- Center director approval system and annual project reviews
- Ability to define custom attributes on resources and allocations
- Integration with 3rd party systems for automation, access control, and other system provisioning tasks

[Read more](docs/pages/index.md)

## Community Supported Plugins

- [OpenStack Plugin](https://github.com/nerc-project/coldfront-plugin-openstack)
- [Keycloak User Search](https://github.com/nerc-project/coldfront-plugin-keycloak)
- [Starfish Plugin](https://github.com/fasrc/coldfront/tree/master/coldfront/plugins/sftocf)
- [Starfish Plugin](https://github.com/fasrc/sftocf)

_Submit a PR to add your plugin to the list above._

Expand Down
2 changes: 1 addition & 1 deletion coldfront/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import sys

__version__ = '1.1.1'
__version__ = '1.1.4'
VERSION = __version__


Expand Down
2 changes: 1 addition & 1 deletion coldfront/config/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
SU_LOGIN_CALLBACK = "coldfront.core.utils.common.su_login_callback"
SU_LOGOUT_REDIRECT_URL = "/su/login/"

SESSION_COOKIE_AGE = 60 * 30
SESSION_COOKIE_AGE = ENV.int('SESSION_INACTIVITY_TIMEOUT', default=60 * 60)
SESSION_SAVE_EVERY_REQUEST = True
SESSION_COOKIE_SAMESITE = 'Strict'
## Need to test with True
Expand Down
6 changes: 5 additions & 1 deletion coldfront/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Base Django settings for ColdFront project.
"""
import os
import sys
import coldfront
from django.core.exceptions import ImproperlyConfigured
from django.core.management.utils import get_random_secret_key
Expand Down Expand Up @@ -53,11 +54,14 @@
]

# Additional Apps
# Hack to fix fontawesome. Will be fixed in version 6
sys.modules['fontawesome_free'] = __import__('fontawesome-free')
INSTALLED_APPS += [
'crispy_forms',
'sslserver',
'django_q',
'simple_history',
'fontawesome_free',
'mathfilters',
# 'debug_toolbar',
# 'ifxuser',
Expand Down Expand Up @@ -161,7 +165,7 @@
raise ImproperlyConfigured('SITE_TEMPLATES should be a path to a directory')

CRISPY_TEMPLATE_PACK = 'bootstrap4'
SETTINGS_EXPORT = []
SETTINGS_EXPORT = ['INSTALLED_APPS']

STATIC_URL = '/static/'
STATIC_ROOT = ENV.str('STATIC_ROOT', default=PROJECT_ROOT('static_root'))
Expand Down
9 changes: 5 additions & 4 deletions coldfront/config/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#------------------------------------------------------------------------------
# General Center Information
#------------------------------------------------------------------------------
CENTER_NAME = ENV.str('CENTER_NAME', default='HPC Resources')
CENTER_NAME = ENV.str('CENTER_NAME', default='HPC Center')
CENTER_HELP_URL = ENV.str('CENTER_HELP_URL', default='help-page')
CENTER_PROJECT_RENEWAL_HELP_URL = ENV.str('CENTER_PROJECT_RENEWAL_HELP_URL', default='')
CENTER_BASE_URL = ENV.str('CENTER_BASE_URL', default='')
Expand Down Expand Up @@ -51,7 +51,8 @@
ALLOCATION_ACCOUNT_MAPPING = ENV.dict('ALLOCATION_ACCOUNT_MAPPING', default={})

SETTINGS_EXPORT += [
'ALLOCATION_ACCOUNT_ENABLED'
'ALLOCATION_ACCOUNT_ENABLED',
'CENTER_HELP_URL'
]

ADMIN_COMMENTS_SHOW_EMPTY = ENV.bool('ADMIN_COMMENTS_SHOW_EMPTY', default=True)
Expand Down Expand Up @@ -91,7 +92,7 @@
Phone: (xxx) xxx-xxx
"""

ACCOUNT_CREATION_TEXT = '''University faculty can submit a help ticket to request an account.
ACCOUNT_CREATION_TEXT = """University faculty can submit a help ticket to request an account.
Please see <a href="#">instructions on our website</a>. Staff, students, and external collaborators must
request an account through a university faculty member.
'''
"""
1 change: 1 addition & 0 deletions coldfront/config/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
EMAIL_OPT_OUT_INSTRUCTION_URL = ENV.str('EMAIL_OPT_OUT_INSTRUCTION_URL', default='')
EMAIL_ALLOCATION_EXPIRING_NOTIFICATION_DAYS = ENV.list('EMAIL_ALLOCATION_EXPIRING_NOTIFICATION_DAYS', cast=int, default=[7, 14, 30])
EMAIL_SIGNATURE = ENV.str('EMAIL_SIGNATURE', default='', multiline=True)
EMAIL_ADMINS_ON_ALLOCATION_EXPIRE = ENV.bool('EMAIL_ADMINS_ON_ALLOCATION_EXPIRE', default=False)
4 changes: 2 additions & 2 deletions coldfront/config/plugins/ldap_fasrc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'''
"""
FASRC-specific LDAP plugin settings
'''
"""
from django.core.exceptions import ImproperlyConfigured

from coldfront.config.env import ENV
Expand Down
1 change: 0 additions & 1 deletion coldfront/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'email.py',
]


# ColdFront plugin settings
plugin_configs = {
'PLUGIN_SLURM': 'plugins/slurm.py',
Expand Down
33 changes: 21 additions & 12 deletions coldfront/core/allocation/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django import forms
from django.db.models.functions import Lower
from django.shortcuts import get_object_or_404

from coldfront.core.allocation.models import (Allocation, AllocationAccount,
Expand All @@ -17,9 +18,9 @@


class AllocationForm(forms.Form):
DEFAULT_DESCRIPTION = '''
DEFAULT_DESCRIPTION = """
We do not have information about your research. Please provide a detailed description of your work and update your field of science. Thank you!
'''
"""
resource = forms.ModelChoiceField(queryset=None, empty_label=None)
quantity = forms.IntegerField(required=True)
justification = forms.CharField(widget=forms.Textarea)
Expand All @@ -29,7 +30,7 @@ class AllocationForm(forms.Form):
def __init__(self, request_user, project_pk, *args, **kwargs):
super().__init__(*args, **kwargs)
project_obj = get_object_or_404(Project, pk=project_pk)
self.fields['resource'].queryset = get_user_resources(request_user)
self.fields['resource'].queryset = get_user_resources(request_user).order_by(Lower("name"))
self.fields['quantity'].initial = 1
user_query_set = project_obj.projectuser_set.select_related('user').filter(
status__name__in=['Active', ]).order_by("user__username")
Expand All @@ -46,7 +47,7 @@ def __init__(self, request_user, project_pk, *args, **kwargs):

class AllocationUpdateForm(forms.Form):
status = forms.ModelChoiceField(
queryset=AllocationStatusChoice.objects.all().order_by('name'), empty_label=None)
queryset=AllocationStatusChoice.objects.all().order_by(Lower("name")), empty_label=None)
start_date = forms.DateField(
label='Start Date',
widget=forms.DateInput(attrs={'class': 'datepicker'}),
Expand Down Expand Up @@ -74,20 +75,20 @@ def clean(self):

class AllocationInvoiceUpdateForm(forms.Form):
status = forms.ModelChoiceField(queryset=AllocationStatusChoice.objects.filter(name__in=[
'Payment Pending', 'Payment Requested', 'Paid']).order_by('name'), empty_label=None)
'Payment Pending', 'Payment Requested', 'Payment Declined', 'Paid']).order_by(Lower("name")), empty_label=None)


class AllocationAddUserForm(forms.Form):
username = forms.CharField(max_length=150, disabled=True)
first_name = forms.CharField(max_length=30, required=False, disabled=True)
first_name = forms.CharField(max_length=150, required=False, disabled=True)
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
selected = forms.BooleanField(initial=False, required=False)


class AllocationRemoveUserForm(forms.Form):
username = forms.CharField(max_length=150, disabled=True)
first_name = forms.CharField(max_length=30, required=False, disabled=True)
first_name = forms.CharField(max_length=150, required=False, disabled=True)
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
selected = forms.BooleanField(initial=False, required=False)
Expand All @@ -111,16 +112,16 @@ class AllocationSearchForm(forms.Form):
label='Username', max_length=100, required=False)
resource_type = forms.ModelChoiceField(
label='Resource Type',
queryset=ResourceType.objects.all().order_by('name'),
queryset=ResourceType.objects.all().order_by(Lower("name")),
required=False)
resource_name = forms.ModelMultipleChoiceField(
label='Resource Name',
queryset=Resource.objects.filter(
is_allocatable=True).order_by('name'),
is_allocatable=True).order_by(Lower("name")),
required=False)
allocation_attribute_name = forms.ModelChoiceField(
label='Allocation Attribute Name',
queryset=AllocationAttributeType.objects.all().order_by('name'),
queryset=AllocationAttributeType.objects.all().order_by(Lower("name")),
required=False)
allocation_attribute_value = forms.CharField(
label='Allocation Attribute Value', max_length=100, required=False)
Expand All @@ -134,7 +135,7 @@ class AllocationSearchForm(forms.Form):
required=False)
status = forms.ModelMultipleChoiceField(
widget=forms.CheckboxSelectMultiple,
queryset=AllocationStatusChoice.objects.all().order_by('name'),
queryset=AllocationStatusChoice.objects.all().order_by(Lower("name")),
required=False)
show_all_allocations = forms.BooleanField(initial=False, required=False)

Expand All @@ -147,7 +148,7 @@ class AllocationReviewUserForm(forms.Form):
)

username = forms.CharField(max_length=150, disabled=True)
first_name = forms.CharField(max_length=30, required=False, disabled=True)
first_name = forms.CharField(max_length=150, required=False, disabled=True)
last_name = forms.CharField(max_length=150, required=False, disabled=True)
email = forms.EmailField(max_length=100, required=False, disabled=True)
user_status = forms.ChoiceField(choices=ALLOCATION_REVIEW_USER_CHOICES)
Expand Down Expand Up @@ -241,3 +242,11 @@ class AllocationChangeNoteForm(forms.Form):
required=False,
widget=forms.Textarea,
help_text="Leave any feedback about the allocation change request.")

class AllocationAttributeCreateForm(forms.ModelForm):
class Meta:
model = AllocationAttribute
fields = '__all__'
def __init__(self, *args, **kwargs):
super(AllocationAttributeCreateForm, self).__init__(*args, **kwargs)
self.fields['allocation_attribute_type'].queryset = self.fields['allocation_attribute_type'].queryset.order_by(Lower('name'))
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Command(BaseCommand):

def handle(self, *args, **options):

for attribute_type in ('Date', 'Float', 'Int', 'Text', 'Yes/No',
for attribute_type in ('Date', 'Float', 'Int', 'Text', 'Yes/No', 'No',
'Attribute Expanded Text'):
AttributeType.objects.get_or_create(name=attribute_type)

for choice in ('Active', 'Inactive',
for choice in ('Active', 'Inactive',
'Paid', 'Ready for Review',
'Payment Requested',
):
Expand All @@ -31,6 +31,13 @@ def handle(self, *args, **options):
for name, attribute_type, has_usage, is_private in (
('Storage Quota (TB)', 'Float', True, False),
('Storage Usage (bytes)', 'Float', True, False),
('Cloud Account Name', 'Text', False, False),
('CLOUD_USAGE_NOTIFICATION', 'Yes/No', False, True),
('Core Usage (Hours)', 'Int', True, False),
('Accelerator Usage (Hours)', 'Int', True, False),
('EXPIRE NOTIFICATION', 'Yes/No', False, True),
('freeipa_group', 'Text', False, False),
('Is Course?', 'Yes/No', False, True),
('Paid', 'Float', False, False),
('Paid Cloud Support (Hours)', 'Float', True, True),
('Paid Network Support (Hours)', 'Float', True, True),
Expand Down
Loading

0 comments on commit e5a06fb

Please sign in to comment.