Commit e47bde52 authored by Vaughn Fajardo's avatar Vaughn Fajardo

style: fixed code with pep8 rule

parent ee420b92
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
\ No newline at end of file
from django.db import models from django.db import models
class Department(models.Model): class Department(models.Model):
dept_name = models.CharField(max_length=50, null=True) dept_name = models.CharField(max_length=50,null=True)
home_unit = models.CharField(max_length=50, null=True) home_unit = models.CharField(max_length=50,null=True)
def __str__(self): def __str__(self):
return self.dept_name return self.dept_name
...@@ -11,9 +11,12 @@ class WidgetUser(models.Model): ...@@ -11,9 +11,12 @@ class WidgetUser(models.Model):
first_name = models.CharField(max_length=50) first_name = models.CharField(max_length=50)
middle_name = models.CharField(max_length=50) middle_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50)
id_num = models.IntegerField(max_length=7, null=True) id_num = models.IntegerField(max_length=7,null=True)
email = models.EmailField(max_length=50, null=True) email = models.EmailField(max_length=50,null=True)
department = models.ForeignKey(Department, on_delete=models.CASCADE, null=True, related_name='department') department = models.ForeignKey(Department,
on_delete=models.CASCADE,
null=True,
related_name='department')
def __str__(self): def __str__(self):
return self.first_name return self.first_name
\ No newline at end of file
from django.urls import path from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
......
...@@ -7,13 +7,11 @@ def welcome(request): ...@@ -7,13 +7,11 @@ def welcome(request):
return HttpResponse('Welcome to Widget!') return HttpResponse('Welcome to Widget!')
def index(request): def index(request):
widget_user_view = 'WIDGET USERS: '
widget_user = WidgetUser.objects.all()
WidgetUserView = 'WIDGET USERS: ' for user in widget_user:
widget_user_view += "<br/> {}, {} {}: {}, {}, {}, {}".\
widgetuser = WidgetUser.objects.all()
for user in widgetuser:
WidgetUserView += "<br/> {}, {} {}: {}, {}, {}, {}".\
format(user.last_name, format(user.last_name,
user.first_name, user.first_name,
user.middle_name, user.middle_name,
...@@ -22,4 +20,4 @@ def index(request): ...@@ -22,4 +20,4 @@ def index(request):
user.department.dept_name, user.department.dept_name,
user.department.home_unit) user.department.home_unit)
return HttpResponse(WidgetUserView) return HttpResponse(widget_user_view)
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment