djangocms-forms icon indicating copy to clipboard operation
djangocms-forms copied to clipboard

Missing migrations

Open AzMoo opened this issue 7 years ago • 2 comments

When installing into Django 1.11 on Python3.6 there are a number of AlterField migrations missing.

If I run makemigrations I get:

Migrations for 'djangocms_forms':
  ~/lib/python3.6/site-packages/djangocms_forms/migrations/0006_auto_20180104_0929.py
    - Alter field cmsplugin_ptr on formdefinition
    - Alter field form_template on formdefinition
    - Alter field field_type on formfield
    - Alter field ip on formsubmission

Ideally these migrations could be added and deployed to PyPI. If you like I can submit a pull request with them but it might be easier for you to do it yourself if you've got a dev environment set up already.

AzMoo avatar Jan 03 '18 23:01 AzMoo

Looking into this.

Alter field cmsplugin_ptr on formdefinition

By default on_delete behaviour used to be django.db.models.CASCADE We can modify the initial migration to just add that.

Alter field form_template on formdefinition Alter field field_type on formfield

Both of the fields are "settings" driven.

i.e if someone changes settings.DJANGOCMS_FORMS_TEMPLATES or settings.DJANGOCMS_FORMS_FIELD_TYPES

This will make django complain about missing migrations!

What we should do is update original migration and change "choices" value to point to settings.

e.g https://github.com/mishbahr/djangocms-forms/blob/master/djangocms_forms/migrations/0001_initial.py#L63

... choices=settings.DJANGOCMS_FORMS_FIELD_TYPES

or https://github.com/mishbahr/djangocms-forms/blob/master/djangocms_forms/migrations/0001_initial.py#L49

should use settings. DJANGOCMS_FORMS_TEMPLATES

Finalllly...

Alter field ip on formsubmission

This is a minor bug. Nothing has changed for the field.

Except the verbose name is not wrapped in ugettext_lazy function i.e _('...') so I bet python 3 it thinks its string now and before it was byte.

This can probably be fixed by changing this line...

https://github.com/mishbahr/djangocms-forms/blob/master/djangocms_forms/models.py#L230

ip = models.GenericIPAddressField(verbose_name=_('IP'), blank=True, null=True)

FYI @riclima if you update your merge request with the above suggestions... I'll be happy to merge it.

Sorry, it took me this long to look into it. I've been super busy recently and I actually haven't used this package or django-cms for years now.

mishbahr avatar Jun 07 '18 17:06 mishbahr

Run into the same issues... Nothing done, yet, isn't it?

jedie avatar Aug 06 '19 12:08 jedie