Skip to content

Commit

Permalink
mant: removendo cascade do endereco da estacao e permitindo estacao c…
Browse files Browse the repository at this point in the history
…om lista vazia de parametros
  • Loading branch information
iagocpv committed Sep 25, 2024
1 parent 7ac7307 commit 3ff9d24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/tupan/estacoes/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.1 on 2024-09-20 14:29
# Generated by Django 5.1.1 on 2024-09-23 13:45

import django.db.models.deletion
from django.db import migrations, models
Expand Down Expand Up @@ -59,8 +59,8 @@ class Migration(migrations.Migration):
('nome', models.CharField(max_length=127)),
('topico', models.CharField(help_text='Tópico do broker MQTT', max_length=127)),
('ativo', models.BooleanField(default=True)),
('endereco', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='estacoes.endereco')),
('parametros', models.ManyToManyField(to='estacoes.parametro')),
('endereco', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='estacoes.endereco')),
('parametros', models.ManyToManyField(blank=True, to='estacoes.parametro')),
],
options={
'verbose_name': 'Estação',
Expand Down
6 changes: 3 additions & 3 deletions src/tupan/estacoes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class Meta:

def __str__(self):
return self.cep

class Estacao(Base):
nome = models.CharField(max_length=127)
endereco = models.OneToOneField(Endereco, on_delete=models.CASCADE)
endereco = models.OneToOneField(Endereco, null=True, on_delete=models.SET_NULL)
topico = models.CharField(help_text="Tópico do broker MQTT", max_length=127)
ativo = models.BooleanField(default=True)
parametros = models.ManyToManyField(Parametro)
parametros = models.ManyToManyField(Parametro, blank=True)

class Meta:
verbose_name = "Estação"
Expand Down

0 comments on commit 3ff9d24

Please sign in to comment.