forked from hydroshare/hs_app_template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
executable file
·216 lines (174 loc) · 8.1 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User, Group
from django.db import models
from mezzanine.pages.models import Page, RichText
from mezzanine.core.models import Ownable
from hs_core.models import AbstractResource, resource_processor
import datetime as dt
from mezzanine.pages.page_processors import processor_for
#
# To create a new resource, use these three super-classes.
#
# noinspection PyInterpreter
class HydroProgramResource(Page, RichText, AbstractResource):
# dublin core attributes are inherited from abstract resource
# title
# description
# creator
# contributor
# subject
# license
############################
# model program attributes #
############################
# version
software_version = models.CharField(verbose_name='Software Version ',null=False,blank=True,default='1.0',max_length=255,
help_text='The software version of the model program')
# program language
software_language = models.CharField(verbose_name="Software Language", null=False,default='',max_length=100,
help_text="The programming language that the model program was written in")
# operating system
operating_sys = models.CharField(verbose_name='Operating System',null=False,blank=True,default='unknown',max_length=255,
help_text='Identify the operating system used by the model program')
# release date
date_released = models.DateTimeField(verbose_name='Date of Software Release',default=dt.datetime.now(),
help_text='The date of the software release (mm/dd/yyyy hh:mm)')
# release notes
release_notes = models.TextField(verbose_name="Release Notes", null=False,default="",
help_text="Notes about the software release (e.g. bug fixes, new functionality)")
# web page
program_website = models.CharField(verbose_name='Model Website', null=True, default= None, max_length=255,
help_text='A URL providing addition information about the software')
# repository
software_repo = models.CharField(verbose_name='Software Repository', null=True, default= None, max_length=255,
help_text='A URL for the source code repository')
# user manual
user_manual = models.FileField(verbose_name='User Manual',name='user_manual', default=None, upload_to='./hs/hydromodel',
help_text='User manual for the model program (e.g. .doc, .md, .rtf, .pdf')
# theoretical manual
theoretical_manual = models.FileField(verbose_name='Theoretical Manual',name='theoretical_manual', default=None, upload_to='./hs/hydromodel',
help_text='Theoretical manual for the model program (e.g. .doc, .md, .rtf, .pdf')
# source code
# This will save the file in ./static/media/hs/hydromodel
source_code = models.FileField(verbose_name='Model Source Code',name='source_code', default=None, upload_to='./hs/hydromodel',
help_text='Upload Model Source Code as *.ZIP')
###########
# missing #
###########
# executable code
exec_code = models.FileField(verbose_name='Model Executable Code',name='exec_code',default=None, upload_to='./hs/hydromodel',
help_text='Upload Model Executables as *.ZIP')
# build notes
build_notes = models.TextField(verbose_name="Build Notes", null=False,default="",
help_text="Notes about building/compiling the source code")
# repository type?
###############
# depreciated #
###############
# url
#software_url = models.CharField(verbose_name='Software URL', null=True, default= None, max_length=255,
# help_text='A URL providing addition information about the software (e.g. source repository, source download, etc...')
# rights
#software_rights = models.TextField(verbose_name="Software Rights", null=False,default="",
# help_text="The software rights of the program (e.g. http://creativecommons.org/licenses/by/4.0)")
#hm_description = models.TextField(verbose_name='Description', null=False,blank=True,default='',
# help_text='Add a short description of the model simulation')
#hm_type = models.CharField(verbose_name='Type', default='Instance',max_length=255,
# help_text='Specify the type of HydroModel (e.g. Model Instance, Model Program, etc...')
# if instance, choose parent model or create parent model
# ###########
# # Program #
# #---------#
# # 1 .. 1 #
# ###########
#
# # title
# title = models.TextField(verbose_name='Program Title', null=False, blank=True, default='',
# help_text='The title of the program')
#
# # organization
# organization = models.TextField(verbose_name='Organization Name', null=False, default='',
# help_text='The organization affiliated with this program')
#
# # description
# description = models.TextField(verbose_name='Program Description', null=False, default='',
# help_text="A brief description of the program")
#
# # subject
# subject = models.TextField(verbose_name='Subject Keywords', null=False, default='',
# help_text='Subject keywords describing the program, delimited by semicolon')
#
# # format
# format = 'application/octet-stream'
#
# # type
# type = 'HydroProgram'
#
# # url
# program_url = models.TextField(verbose_name='Program URL', null=True, default=None,
# help_text='A URL providing additional information about the program as a whole (e.g. website, documentation, etc...)')
#
############
# SOFTWARE #
#----------#
# 1 .. 1 #
############
# ####################
# # REQUIREMENT #
# #------------------#
# # cardinality 0..* #
# ####################
#
# # subject
# req_subject = models.TextField(verbose_name='Subject Keywords', null=True, default=None,
# help_text='Subject keywords describing the software requirement, delimited by semicolon')
#
# # description
# req_description = models.TextField(verbose_name="Requirement Description", null=False,default='',
# help_text="A description of the software requirement")
#
# # url
# req_url = models.TextField(verbose_name='Requirement URL', null=True, default=None,
# help_text="A URL providing additional information regarding the software requirement.")
###########
# CREATOR #
#---------#
# 1 .. 1 #
###########
# name
# organization
# address
# email
# phone
# url
###############
# CONTRIBUTOR #
#-------------#
# 0 .. * #
###############
# name
# organization
# address
# email
# phone
# url
########
# Date #
#------#
# 1..1 #
########
# created
# modified
# #######################
# # TEMPORAL DEFINITION #
# #######################
# # Only for Instance Types
# hm_begin = models.DateTimeField(verbose_name='Simulation Begin',
# help_text='The start date of the model simulation (mm/dd/yyyy hh:mm)')
# hm_end = models.DateTimeField(verbose_name='Simulation End',
# help_text='The end date of the model simulation (mm/dd/yyyy hh:mm)')
# hm_timestep = models.FloatField(verbose_name='Simulation Time Interval',
# help_text='The timestep interval that is used for calculations (in seconds)')
class Meta:
verbose_name = 'HydroProgram'
processor_for(HydroProgramResource)(resource_processor)