Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
kszkepzes
old
kszkepzes-backend
Commits
a4c2d173
Unverified
Commit
a4c2d173
authored
6 years ago
by
Máté Bodor
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request
#41
from DevTeamSCH/note
Note
parents
12ff1915
c7037278
No related branches found
No related tags found
No related merge requests found
Pipeline
#3164
failed
4 years ago
Stage: lint
Stage: test
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/common/email.py
+2
-2
2 additions, 2 deletions
src/common/email.py
src/common/emails/registration.txt
+1
-1
1 addition, 1 deletion
src/common/emails/registration.txt
src/document/models.py
+22
-2
22 additions, 2 deletions
src/document/models.py
src/stats/views.py
+2
-2
2 additions, 2 deletions
src/stats/views.py
with
27 additions
and
7 deletions
src/common/email.py
+
2
−
2
View file @
a4c2d173
from
django.core.mail
import
send_mail
import
codecs
sender_email
=
'
noreply@
kszkepzes
.sch.bme.hu
'
link
=
'
kszkepzes
.sch.bme.hu/homework
'
sender_email
=
'
noreply@
ujonc
.sch.bme.hu
'
link
=
'
https://ujonc
.sch.bme.hu/homework
'
def
read_email
(
name
):
...
...
This diff is collapsed.
Click to expand it.
src/common/emails/registration.txt
+
1
−
1
View file @
a4c2d173
Kedves %(name)s
!
Szia
!
Örömmel vettük jelenkezésedet az idei KSZKépzés programunkba. Azonban ahhoz, hogy ezt el is tudjuk bírálni, még szükségünk van pár dologra tőled:
- ki kell töltened a profilodat,
...
...
This diff is collapsed.
Click to expand it.
src/document/models.py
+
22
−
2
View file @
a4c2d173
import
os
from
django.db
import
models
from
django.core
import
validators
from
django.dispatch
import
receiver
from
account.models
import
Profile
from
homework.models
import
Solution
from
common.validators
import
FileSizeValidator
def
document_file_name
(
instance
,
filename
):
return
'
/
'
.
join
([
'
document
'
,
instance
.
solution
.
task
.
title
,
instance
.
uploaded_by
.
full_name
,
filename
])
class
Document
(
models
.
Model
):
uploaded_by
=
models
.
ForeignKey
(
Profile
,
on_delete
=
models
.
DO_NOTHING
)
uploaded_at
=
models
.
DateTimeField
(
auto_now_add
=
True
,
editable
=
False
)
...
...
@@ -22,9 +33,18 @@ class Document(models.Model):
FileSizeValidator
(
size_limit
=
52428800
),
# 52428800 - 50MiB
],
blank
=
True
,
null
=
True
null
=
True
,
upload_to
=
document_file_name
)
solution
=
models
.
ForeignKey
(
Solution
,
related_name
=
'
files
'
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
self
.
name
# Deletes file from filesystem when File object is deleted.
@receiver
(
models
.
signals
.
post_delete
,
sender
=
Document
)
def
auto_delete_file_on_delete
(
sender
,
instance
,
**
kwargs
):
if
instance
.
file
:
if
os
.
path
.
isfile
(
instance
.
file
.
path
):
os
.
remove
(
instance
.
file
.
path
)
This diff is collapsed.
Click to expand it.
src/stats/views.py
+
2
−
2
View file @
a4c2d173
...
...
@@ -25,9 +25,9 @@ class NoteViewSet(viewsets.ModelViewSet):
profile_id
=
self
.
request
.
query_params
.
get
(
'
profileID
'
,
None
)
event_id
=
self
.
request
.
query_params
.
get
(
'
eventID
'
,
None
)
if
profile_id
is
not
None
and
event_id
is
not
None
:
return
queryset
.
filter
(
user
=
profile_id
,
event
=
event_id
)
return
queryset
.
filter
(
profile
=
profile_id
,
event
=
event_id
)
if
profile_id
is
not
None
:
return
queryset
.
filter
(
user
=
profile_id
)
return
queryset
.
filter
(
profile
=
profile_id
)
if
event_id
is
not
None
:
return
queryset
.
filter
(
event
=
event_id
)
return
queryset
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