Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angelico Ruiz T. Teaño
widget_Alipins
Commits
a3d5a0e1
Commit
a3d5a0e1
authored
May 19, 2022
by
Irish Danielle Morales
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add button and form to create widget user
parent
c0d3b24d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
6 deletions
+73
-6
db.sqlite3
widget_alipins/db.sqlite3
+0
-0
forms.py
widget_alipins/homepage/forms.py
+9
-0
models.py
widget_alipins/homepage/models.py
+4
-1
index.html
widget_alipins/homepage/templates/homepage/index.html
+6
-0
widgetuser_form.html
..._alipins/homepage/templates/homepage/widgetuser_form.html
+22
-0
urls.py
widget_alipins/homepage/urls.py
+2
-1
views.py
widget_alipins/homepage/views.py
+7
-2
style.css
widget_alipins/static/homepage/style.css
+23
-2
No files found.
widget_alipins/db.sqlite3
View file @
a3d5a0e1
No preview for this file type
widget_alipins/homepage/forms.py
0 → 100644
View file @
a3d5a0e1
from
statistics
import
mode
from
django
import
forms
from
.models
import
WidgetUser
class
WidgetUserForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
WidgetUser
fields
=
[
'last_name'
,
'first_name'
,
'middle_name'
,
'id_num'
,
'email'
,
'department'
,
'image'
]
\ No newline at end of file
widget_alipins/homepage/models.py
View file @
a3d5a0e1
...
...
@@ -22,4 +22,7 @@ class WidgetUser(models.Model):
def
__str__
(
self
):
full_name
=
self
.
first_name
+
" "
+
self
.
middle_name
+
" "
+
self
.
last_name
return
full_name
\ No newline at end of file
return
full_name
def
get_absolute_url
(
self
):
return
u'
%
d/details'
%
self
.
pk
\ No newline at end of file
widget_alipins/homepage/templates/homepage/index.html
View file @
a3d5a0e1
...
...
@@ -27,4 +27,10 @@
<p>
There are no existing users.
</p>
{% endif %}
</div>
<div
class=
"add-button"
>
<a
href=
"{% url 'homepage:userCreate' %}"
>
<button
type=
"button"
>
Add Widget User
</button>
</a>
</div>
{% endblock %}
\ No newline at end of file
widget_alipins/homepage/templates/homepage/widgetuser_form.html
0 → 100644
View file @
a3d5a0e1
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'homepage/style.css' %}"
>
{% endblock %}
{% block title %}{{object.pk}}{% endblock %}
{% block content %}
<nav
class=
"topnav"
>
<a
href=
"{% url 'homepage:indexHomepage' %}"
>
Homepage
</a>
<a
href=
"{% url 'announcements:indexAnnouncements' %}"
>
Announcements
</a>
<a
href=
"{% url 'forum:indexForum' %}"
>
Forum
</a>
<a
href=
"{% url 'assignments:indexAssignments' %}"
>
Assignments
</a>
</nav>
<form
method=
"POST"
enctype=
"multipart/form-data"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Submit"
>
</form>
{% endblock %}
\ No newline at end of file
widget_alipins/homepage/urls.py
View file @
a3d5a0e1
...
...
@@ -4,5 +4,6 @@ from . import views
app_name
=
"homepage"
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"indexHomepage"
),
path
(
'<int:pk>/details'
,
views
.
UserDetailView
.
as_view
(),
name
=
"userDetails"
)
path
(
'users/<int:pk>/details'
,
views
.
UserDetailView
.
as_view
(),
name
=
"userDetails"
),
path
(
'users/add'
,
views
.
UserCreateView
.
as_view
(),
name
=
"userCreate"
)
]
\ No newline at end of file
widget_alipins/homepage/views.py
View file @
a3d5a0e1
from
django.http
import
Http404
from
multiprocessing
import
context
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
.models
import
WidgetUser
def
index
(
request
):
...
...
@@ -12,4 +13,8 @@ def index(request):
return
render
(
request
,
"homepage/index.html"
,
context
)
class
UserDetailView
(
DetailView
):
model
=
WidgetUser
\ No newline at end of file
model
=
WidgetUser
class
UserCreateView
(
CreateView
):
model
=
WidgetUser
fields
=
[
'last_name'
,
'first_name'
,
'middle_name'
,
'id_num'
,
'email'
,
'department'
,
'image'
]
\ No newline at end of file
widget_alipins/static/homepage/style.css
View file @
a3d5a0e1
...
...
@@ -52,7 +52,6 @@ body::-webkit-scrollbar {
margin
:
auto
;
width
:
20%
;
padding
:
30px
70px
;
margin-bottom
:
100px
;
color
:
white
;
border-top
:
1px
solid
white
;
border-bottom
:
1px
solid
white
;
...
...
@@ -180,9 +179,31 @@ a:hover {
h1
.welcome
{
font-size
:
7vw
;
margin
:
14vh
0
9vh
0
;
margin
:
9vh
0
;
padding
:
1vh
0
1vh
0
;
color
:
white
;
font-family
:
"Inter"
;
background-color
:
#121212
;
}
.add-button
{
text-align
:
center
;
}
.add-button
>
a
{
display
:
inline-block
;
margin
:
20px
auto
;
}
button
{
background-color
:
#121212
;
color
:
white
;
border
:
0px
;
border-radius
:
10px
;
padding
:
10px
20px
;
font
:
15px
'Inter'
;
}
button
:hover
{
color
:
#e1bb54
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment