Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Untis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mike Gabriel
AlekSIS-App-Untis
Commits
4f203db4
Verified
Commit
4f203db4
authored
5 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Add constance settings for untis db
parent
2aacff98
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/apps/untis/schoolapps_util.py
+53
-0
53 additions, 0 deletions
aleksis/apps/untis/schoolapps_util.py
aleksis/apps/untis/settings.py
+24
-0
24 additions, 0 deletions
aleksis/apps/untis/settings.py
aleksis/apps/untis/util.py
+0
-7
0 additions, 7 deletions
aleksis/apps/untis/util.py
with
77 additions
and
7 deletions
aleksis/apps/untis/schoolapps_util.py
0 → 100644
+
53
−
0
View file @
4f203db4
from
datetime
import
date
,
time
,
timedelta
from
typing
import
BinaryIO
,
Optional
,
Union
from
xml.dom
import
Node
,
minidom
from
django.http
import
HttpRequest
from
django.utils.translation
import
ugettext
as
_
from
untisconnect.api
import
TYPE_TEACHER
,
get_teacher_by_shortcode
,
TYPE_CLASS
,
get_class_by_name
,
get_all_teachers
,
\
get_all_classes
,
get_all_rooms
,
get_all_subjects
from
untisconnect.datetimeutils
import
get_calendar_week
,
calendar_week
,
weekday
from
untisconnect.plan
import
get_plan
from
userinformation
import
UserInformation
def
get_type_and_object_of_user
(
user
):
_type
=
UserInformation
.
user_type
(
user
)
if
_type
==
UserInformation
.
TEACHER
:
# Teacher
_type
=
TYPE_TEACHER
shortcode
=
user
.
username
el
=
get_teacher_by_shortcode
(
shortcode
)
elif
_type
==
UserInformation
.
STUDENT
:
# Student
_type
=
TYPE_CLASS
_name
=
UserInformation
.
user_classes
(
user
)[
0
]
el
=
get_class_by_name
(
_name
)
else
:
# Nothing of both
return
None
,
None
return
_type
,
el
def
overview_dict
():
return
{
'
teachers
'
:
get_all_teachers
(),
'
classes
'
:
get_all_classes
(),
'
rooms
'
:
get_all_rooms
(),
'
subjects
'
:
get_all_subjects
()
}
def
get_plan_for_day
(
_type
,
plan_id
,
date
):
# Get calendar week and monday of week
monday_of_week
=
get_calendar_week
(
calendar_week
(
date
),
date
.
year
)[
"
first_day
"
]
week_day
=
weekday
(
date
)
# Get plan
plan
,
holidays
=
get_plan
(
_type
,
plan_id
,
smart
=
True
,
monday_of_week
=
monday_of_week
)
lessons
=
[(
row
[
week_day
],
time
)
for
row
,
time
in
plan
]
holidays_for_date
=
holidays
[
week_day
]
return
lessons
,
holidays_for_date
This diff is collapsed.
Click to expand it.
aleksis/apps/untis/settings.py
0 → 100644
+
24
−
0
View file @
4f203db4
from
aleksis.core.util.core_helpers
import
lazy_config
DATABASES
=
{
'
untis
'
:
{
'
ENGINE
'
:
'
django.db.backends.mysql
'
,
'
NAME
'
:
lazy_config
(
"
UNTIS_NAME
"
),
'
USER
'
:
lazy_config
(
"
UNTIS_USER
"
),
'
PASSWORD
'
:
lazy_config
(
"
UNTIS_PASSWORD
"
),
'
HOST
'
:
lazy_config
(
"
UNTIS_HOST
"
),
'
PORT
'
:
lazy_config
(
"
UNTIS_PORT
"
),
}
}
CONSTANCE_CONFIG
=
{
"
UNTIS_NAME
"
:
(
"
untis
"
,
_
(
"
Name of database
"
),
"
char_field
"
),
"
UNTIS_USER
"
:
(
"
aleksis
"
,
_
(
"
Database user
"
),
"
char_field
"
),
"
UNTIS_PASSWORD
"
:
(
"
aleksis
"
,
_
(
"
Database password
"
),
"
char_field
"
),
"
UNTIS_HOST
"
:
(
"
127.0.0.1
"
,
_
(
"
Database host
"
),
"
char_field
"
),
"
UNTIS_PORT
"
:
(
"
3306
"
,
_
(
"
Database port
"
),
"
char_field
"
),
}
CONSTANCE_CONFIG_FIELDSETS
=
{
"
Untis Database Settings
"
:
(
"
UNTIS_NAME
"
,
"
UNTIS_USER
"
,
"
UNTIS_PASSWORD
"
,
"
UNTIS_HOST
"
,
"
UNTIS_PORT
"
),
}
This diff is collapsed.
Click to expand it.
aleksis/apps/untis/util.py
+
0
−
7
View file @
4f203db4
...
...
@@ -10,13 +10,6 @@ from aleksis.core.models import Group, Person
from
aleksis.core.util
import
messages
from
untisconnect.api
import
TYPE_TEACHER
,
get_teacher_by_shortcode
,
TYPE_CLASS
,
get_class_by_name
,
get_all_teachers
,
\
get_all_classes
,
get_all_rooms
,
get_all_subjects
from
untisconnect.datetimeutils
import
get_calendar_week
,
calendar_week
,
weekday
from
untisconnect.plan
import
get_plan
from
userinformation
import
UserInformation
def
get_child_node_text
(
node
:
Node
,
tag
:
str
)
->
Optional
[
str
]:
tag_nodes
=
node
.
getElementsByTagName
(
tag
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment