Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adega
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
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
Odair M.
adega
Commits
2a37e1d8
Commit
2a37e1d8
authored
6 years ago
by
Odair Mario
Browse files
Options
Downloads
Patches
Plain Diff
muda o nome course para degree
parent
6072c5f5
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
WIP: Development
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/adega/models.py
+0
-13
0 additions, 13 deletions
src/adega/models.py
src/uploads/admin.py
+1
-1
1 addition, 1 deletion
src/uploads/admin.py
src/uploads/models.py
+4
-4
4 additions, 4 deletions
src/uploads/models.py
src/uploads/views.py
+2
-1
2 additions, 1 deletion
src/uploads/views.py
with
7 additions
and
19 deletions
src/adega/models.py
+
0
−
13
View file @
2a37e1d8
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
ValidationError
class
Course
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
40
)
code
=
models
.
CharField
(
max_length
=
40
)
manager
=
models
.
ForeignKey
(
User
)
def
clean_code
(
self
):
if
'
/
'
in
self
.
code
:
raise
ValidationError
(
'
Valor inválido: O código não pode conter
"
/
"'
)
class
Professor
(
models
.
Model
):
user
=
models
.
OneToOneField
(
User
)
This diff is collapsed.
Click to expand it.
src/uploads/admin.py
+
1
−
1
View file @
2a37e1d8
...
...
@@ -23,7 +23,7 @@ def make_analysis(modeladmin, request, queryset):
class
SubmissionAdmin
(
admin
.
ModelAdmin
):
date_hierarchy
=
'
timestamp
'
list_display
=
(
'
author
'
,
'
cours
e
'
,
'
processed
'
,
'
last
'
,
'
timestamp
'
)
list_display
=
(
'
author
'
,
'
degre
e
'
,
'
processed
'
,
'
last
'
,
'
timestamp
'
)
actions
=
[
make_analysis
]
...
...
This diff is collapsed.
Click to expand it.
src/uploads/models.py
+
4
−
4
View file @
2a37e1d8
...
...
@@ -5,7 +5,7 @@ from django.utils import timezone
from
os
import
path
from
django.conf
import
settings
from
a
deg
a
.models
import
Course
from
deg
ree
.models
import
Degree
def
get_path
(
instance
,
filename
):
...
...
@@ -26,7 +26,7 @@ class Submission(models.Model):
historico
=
models
.
FileField
(
upload_to
=
get_path
)
matricula
=
models
.
FileField
(
upload_to
=
get_path
)
cours
e
=
models
.
ForeignKey
(
Cours
e
)
degre
e
=
models
.
ForeignKey
(
Degre
e
)
timestamp
=
models
.
DateTimeField
(
default
=
timezone
.
now
)
...
...
@@ -45,11 +45,11 @@ class Submission(models.Model):
done_in
=
models
.
DateTimeField
(
null
=
True
)
def
path
(
self
):
return
path
.
join
(
settings
.
MEDIA_ROOT
,
self
.
cours
e
.
code
,
str
(
self
.
id
))
return
path
.
join
(
settings
.
MEDIA_ROOT
,
self
.
degre
e
.
code
,
str
(
self
.
id
))
def
__str__
(
self
):
return
'
Submission (from: {}, to: {}, on: {})
'
.
format
(
self
.
author
.
first_name
,
self
.
cours
e
.
name
,
self
.
degre
e
.
name
,
self
.
timestamp
)
def
set_done
(
self
,
time
):
...
...
This diff is collapsed.
Click to expand it.
src/uploads/views.py
+
2
−
1
View file @
2a37e1d8
...
...
@@ -6,11 +6,12 @@ from django.contrib import messages
from
uploads.models
import
Submission
@login_required
def
upload
(
request
):
if
request
.
method
==
'
POST
'
and
request
.
FILES
[
'
historico
'
]
and
request
.
FILES
[
'
matricula
'
]:
submission
=
Submission
.
objects
.
create
(
author
=
request
.
user
)
submission
.
course
=
'
21A
'
submission
.
degree
=
request
.
user
.
degree
fs
=
FileSystemStorage
(
location
=
submission
.
path
())
...
...
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