mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Delete CotisationsOption.pres_name and better migration.
This commit is contained in:
parent
621cdc9659
commit
7db8872bc8
3 changed files with 11 additions and 12 deletions
|
@ -13,7 +13,8 @@ def create_current_mandate(apps, schema_editor):
|
|||
AssoOption = apps.get_model('preferences', 'AssoOption')
|
||||
Mandate = apps.get_model('preferences', 'Mandate')
|
||||
Adherent = apps.get_model('users', 'Adherent')
|
||||
pres_name = AssoOption.objects.get_or_create()[0].pres_name
|
||||
assooption = AssoOption.objects.get_or_create()[0]
|
||||
pres_name = assooption.pres_name
|
||||
l = pres_name.split(' ')
|
||||
try:
|
||||
name, surname = l[0], l[1]
|
||||
|
@ -23,7 +24,11 @@ def create_current_mandate(apps, schema_editor):
|
|||
start_date=timezone.now(),
|
||||
)
|
||||
except Exception as e:
|
||||
print("Warning : I was unable to find an adherent corresponding to %s. You might want to edit your preferences afterward." % pres_name)
|
||||
print("Warning : I was unable to find an adherent corresponding to %s. You might want to edit your preferences afterward. I will disable the sending of vouchers by email." % pres_name)
|
||||
CotisationsOption = apps.get_model('preferences', 'CotisationsOption')
|
||||
cotisoption = CotisationsOption.objects.get_or_create()[0]
|
||||
cotisoption.send_voucher_mail = False
|
||||
cotisoption.save()
|
||||
|
||||
|
||||
|
||||
|
@ -56,4 +61,8 @@ class Migration(migrations.Migration):
|
|||
name='send_voucher_mail',
|
||||
field=models.BooleanField(default=False, help_text='Be carefull, if no mandate is defined on the preferences page, errors will be triggered when generating vouchers.', verbose_name='Send voucher by email when the invoice is controlled.'),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='assooption',
|
||||
name='pres_name',
|
||||
),
|
||||
]
|
||||
|
|
|
@ -573,12 +573,6 @@ class AssoOption(AclMixin, PreferencesModel):
|
|||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
pres_name = models.CharField(
|
||||
max_length=255,
|
||||
default="",
|
||||
verbose_name=_("President of the association"),
|
||||
help_text=_("Displayed on subscription vouchers")
|
||||
)
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
|
|
|
@ -325,10 +325,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<th>{% trans "Description of the organisation" %}</th>
|
||||
<td>{{ assooptions.description|safe }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans "President of the association"%}</th>
|
||||
<td>{{ assooptions.pres_name }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h5>{% trans "Mandates" %}</h5>
|
||||
{% can_create Mandate %}
|
||||
|
|
Loading…
Reference in a new issue