Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Lattes curriculum to members and gas sensor to dashboard #33

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class CustomUserAdmin(UserAdmin):
'fields': (
'profile_photo',
'description',
'is_advisor'
'is_advisor',
'lattes_url'
),
},
),
Expand Down
9 changes: 6 additions & 3 deletions app/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@


def generateAllMotes24hRaw():
for n in range(1, 3):
for n in range(1, 4):
idList = list(Device.objects.filter(
type=n, is_authorized=True).values_list('id', flat=True))
dataFrameList = []

mediaRoot = settings.MEDIA_ROOT
if (n == 1):
if n == 1:
mediaPath = f'graphs/allWMoteDevices24hRaw.html'
collectionUnit = 'Consumo(L)'
else:
elif n == 2:
mediaPath = f'graphs/allEMoteDevices24hRaw.html'
collectionUnit = 'Consumo(Watts)'
else:
mediaPath = 'graphs/allGMoteDevices24hRaw.html'
collectionUnit = 'Consumo(m³)'

for i in idList:
counter = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.0.1 on 2024-05-24 00:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('app', '0007_device_is_authorized'),
]

operations = [
migrations.AddField(
model_name='extenduser',
name='lattes_url',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='device',
name='type',
field=models.IntegerField(choices=[(0, 'Not Defined'), (1, 'Water'), (2, 'Energy'), (3, 'Gas')], default=0),
),
migrations.AlterField(
model_name='graph',
name='type',
field=models.IntegerField(choices=[(0, 'Not Defined'), (1, 'All WMote Devices | 24h | Raw'), (2, 'All EMote Devices | 24h | Raw'), (3, 'All GMote Devices | 24h | Raw')], default=0),
),
]
5 changes: 4 additions & 1 deletion app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@
class DeviceTypes(models.IntegerChoices):
none = 0, 'Not Defined',
water = 1, 'Water',
energy = 2, 'Energy'
energy = 2, 'Energy',
gas = 3, 'Gas'


class GraphsTypes(models.IntegerChoices):
none = 0, 'Not Defined',
allWMoteDevices24hRaw = 1, 'All WMote Devices | 24h | Raw',
allEMoteDevices24hRaw = 2, 'All EMote Devices | 24h | Raw',
allGMoteDevices24hRaw = 3, 'All GMote Devices | 24h | Raw'


class ExtendUser(AbstractUser):
profile_photo = models.ImageField(
upload_to='profile/', default='defaults/profile_default.png')
description = models.CharField(max_length=256, blank=True)
is_advisor = models.BooleanField(default=False)
lattes_url = models.URLField(max_length=200, blank=True, null=True)

def __str__(self):
if (self.first_name) and (self.last_name):
Expand Down
3 changes: 3 additions & 0 deletions app/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ <h1>Gráficos Brutos das Últimas 24 horas</h1>
<div class="graph">
<iframe class="iframe" src="{% get_media_prefix %}{{eMote.file_path}}" title="test"></iframe>
</div>
<div class="graph">
<iframe class="iframe" src="{% get_media_prefix %}{{gMote.file_path}}" title="test"></iframe>
</div>
</div>
{% endblock %}

6 changes: 6 additions & 0 deletions app/templates/members.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ <h3>{{member.first_name}} {{member.last_name}}</h3>
<h3>{{member.username}}</h3>
{% endif %}
<p>{{member.description}}</p>
{% if member.lattes_url %}
<p><a href="{{member.lattes_url}}" target="_blank">Currículo Lattes</a></p>
{% endif %}
</div>
{% endfor %}
</div>
Expand All @@ -39,6 +42,9 @@ <h3>{{member.first_name}} {{member.last_name}}</h3>
<h3>{{member.username}}</h3>
{% endif %}
<p>{{member.description}}</p>
{% if member.lattes_url %}
<p><a href="{{member.lattes_url}}" target="_blank">Currículo Lattes</a></p>
{% endif %}
</div>
{% endfor %}
</div>
Expand Down
3 changes: 2 additions & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def dashboard(request):

allWMotes24hRaw = Graph.objects.get(type=1)
allEMotes24hRaw = Graph.objects.get(type=2)
allGMotes24hRaw = Graph.objects.get(type=3)

return render(request, 'dashboard.html', {'wMote': allWMotes24hRaw, 'eMote': allEMotes24hRaw})
return render(request, 'dashboard.html', {'wMote': allWMotes24hRaw, 'eMote': allEMotes24hRaw, 'gMote': allGMotes24hRaw})


def members(request):
Expand Down
Loading