Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_father when can i be on my own i have the hello world to see
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
father when can i be on my own i have the hello world to see
widget_father when can i be on my own i have the hello world to see
Commits
6fa0b8c1
Commit
6fa0b8c1
authored
May 23, 2022
by
Charles Lim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed image uploading and rendering for homepage.
parent
338f3476
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
8 deletions
+45
-8
0007_alter_widgetuser_profile_pic.py
homepage/migrations/0007_alter_widgetuser_profile_pic.py
+18
-0
0008_alter_widgetuser_profile_pic.py
homepage/migrations/0008_alter_widgetuser_profile_pic.py
+18
-0
models.py
homepage/models.py
+2
-5
widgetuser_detail.html
homepage/templates/homepage/widgetuser_detail.html
+6
-2
widgetuser_form.html
homepage/templates/homepage/widgetuser_form.html
+1
-1
No files found.
homepage/migrations/0007_alter_widgetuser_profile_pic.py
0 → 100644
View file @
6fa0b8c1
# Generated by Django 4.0.4 on 2022-05-23 04:37
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0006_widgetuser_profile_pic'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'widgetuser'
,
name
=
'profile_pic'
,
field
=
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
'media/homepage'
),
),
]
homepage/migrations/0008_alter_widgetuser_profile_pic.py
0 → 100644
View file @
6fa0b8c1
# Generated by Django 4.0.4 on 2022-05-23 04:41
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0007_alter_widgetuser_profile_pic'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'widgetuser'
,
name
=
'profile_pic'
,
field
=
models
.
ImageField
(
blank
=
True
,
null
=
True
,
upload_to
=
'media/homepage'
),
),
]
homepage/models.py
View file @
6fa0b8c1
from
django.db
import
models
from
django.db
import
models
# Model for Department
class
Department
(
models
.
Model
):
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
100
)
dept_name
=
models
.
CharField
(
max_length
=
100
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
...
@@ -9,8 +8,6 @@ class Department(models.Model):
...
@@ -9,8 +8,6 @@ class Department(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
dept_name
+
", "
+
self
.
home_unit
return
self
.
dept_name
+
", "
+
self
.
home_unit
# Model for Widget User
class
WidgetUser
(
models
.
Model
):
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
100
)
first_name
=
models
.
CharField
(
max_length
=
100
)
...
@@ -19,8 +16,8 @@ class WidgetUser(models.Model):
...
@@ -19,8 +16,8 @@ class WidgetUser(models.Model):
id_num
=
models
.
CharField
(
max_length
=
7
,
default
=
"123456"
)
id_num
=
models
.
CharField
(
max_length
=
7
,
default
=
"123456"
)
email
=
models
.
EmailField
(
email
=
models
.
EmailField
(
max_length
=
256
,
default
=
"john.appleseed@gmail.com"
)
max_length
=
256
,
default
=
"john.appleseed@gmail.com"
)
profile_pic
=
models
.
Fil
eField
(
profile_pic
=
models
.
Imag
eField
(
upload_to
=
"
uploads
"
,
null
=
True
,
blank
=
True
)
upload_to
=
"
media/homepage
"
,
null
=
True
,
blank
=
True
)
department
=
models
.
ForeignKey
(
department
=
models
.
ForeignKey
(
Department
,
Department
,
on_delete
=
models
.
SET_NULL
,
on_delete
=
models
.
SET_NULL
,
...
...
homepage/templates/homepage/widgetuser_detail.html
View file @
6fa0b8c1
...
@@ -9,7 +9,11 @@
...
@@ -9,7 +9,11 @@
{% endblock %}
{% endblock %}
{% block header %}
{% block header %}
{% if object.profile_pic != None and object.profile_pic != '' %}
<img
width=
60
height=
60
src=
"{% get_media_prefix %}{{object.profile_pic}}"
/>
{% else %}
<img
width=
60
height=
60
src=
"{% static 'homepage/default_profilepic.png' %}"
/>
<img
width=
60
height=
60
src=
"{% static 'homepage/default_profilepic.png' %}"
/>
{% endif %}
{{object.last_name}}, {{object.first_name}} {{object.middle_name}}
{{object.last_name}}, {{object.first_name}} {{object.middle_name}}
{% endblock %}
{% endblock %}
...
...
homepage/templates/homepage/widgetuser_form.html
View file @
6fa0b8c1
...
@@ -16,6 +16,6 @@
...
@@ -16,6 +16,6 @@
<form
method=
"post"
>
<form
method=
"post"
>
{% csrf_token %}
{% csrf_token %}
{{ form.as_p }}
{{ form.as_p }}
<input
type=
"submit"
value=
"S
ubmit
"
>
<input
type=
"submit"
value=
"S
ave New User
"
>
</form>
</form>
{% endblock %}
{% endblock %}
\ 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