-
Notifications
You must be signed in to change notification settings - Fork 703
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
SortableStackedInlines change order #609
Comments
I will need some more info to see where is the problem:
.form-horizontal .hide {
display: block !important;
}
|
Hi, here you have the recording. Inline formsets are big and don't fit in my screen, but after hitting save, all of their order fields get reduced by 1. The fields in this recording are taken directly from the model, which has the following fields: class StopRequest(AuthorityModel):
biweekly_choices = (('1', _("First fortnight")),
('2', _('Second fortnight')),)
even_odd_weeks_choices = (('1', _('Odd weeks')),
('2', _('Even weeks')))
route_type_choices = (('1', _('Going')),
('2', _('Return')),)
order = models.PositiveIntegerField(default=0)
student = models.ForeignKey(Student, verbose_name=_("Student"), related_name="stop_requests")
route_type = models.CharField(max_length=10, verbose_name=_("Route type"), choices=route_type_choices)
outward_route = models.ForeignKey(Route, related_name="outward_routes", verbose_name=_("Outward Route"), null=True,
blank=True, limit_choices_to={"route_type": "1"})
outward_stop = ChainedForeignKey(RouteStop, verbose_name=_("Outward Stop"), chained_field="outward_route",
chained_model_field="route", show_all=False, auto_choose=True, sort=True,
related_name="stop_outward_stop", null=True, blank=True)
return_route = models.ForeignKey(Route, verbose_name=_("Return Route"), related_name="stop_return_route", null=True,
blank=True, limit_choices_to={"route_type": "2"})
return_stop = ChainedForeignKey(RouteStop, verbose_name=_("Return Stop"), chained_field="return_route",
chained_model_field="route", show_all=False, auto_choose=True, sort=True,
related_name="stop__return_stop", null=True, blank=True)
all_grade = models.BooleanField(default=True, verbose_name=_("Entire school year"))
date_start = models.DateField(verbose_name=_("Start date"), null=True, blank=True)
date_end = models.DateField(verbose_name=_("End date"), null=True, blank=True)
frequency = FrequencyField(verbose_name=_("Frequency"), default="1")
weekdays = models.ManyToManyField(Weekday, verbose_name=_("Weekdays"), related_name="stop_requests", blank=True)
month_part = models.CharField(max_length=1, verbose_name=_("Fortnights"), null=True, blank=True,
choices=biweekly_choices)
months = models.ManyToManyField(Month, verbose_name=_("Months"), related_name="stop_requests", blank=True)
even_odd_week = models.CharField(max_length=10, verbose_name=_("Even/Odd weeks"), null=True, blank=True,
choices=even_odd_weeks_choices)
observation = models.TextField(max_length=1000, verbose_name=_("Observation"), blank=True, null=True) And the AuthorityModel class from which this inherits has the following fields: class AuthorityModel(models.Model):
created_by = models.ForeignKey('AuthUser', editable=False, null=True,
related_name='created_by_%(class)s', verbose_name=_('Created by'))
modified_by = models.ForeignKey('AuthUser', editable=False, null=True,
related_name='modified_by_%(class)s', verbose_name=_('Modified by')) |
Hi, any news on this? |
i have some bug |
I have same bug.. Tried lots of things.. Not working.. I belive frontend related issue.. Django (1.11.6) MODELS.py
ADMINS.py
|
I find the problem actualy, its on suit/static/js/sortable.js |
If this is a bug please specify versions you're using first.
Django version: 1.10.6
Django Suit version: 0.2.25
Python version: 2.7.13
Issue:
I have a SortableStackedInline in my admin and when saving it changes the order of everything, even without making any changes. It is true that i'm using some JS to hide/show values or even to filter select options, but I tried with SortableTabularInline and admin.StackedInline and I don't get this behavior.
For example, if I have 3 formsets with order 0, 1 and 2 and hit save, it will save two of them with orders 0 and 1, and the final result for ordering will be 0,0,1. If I hit save again, all order values will be 0. This value gets like this into the clean method of the form, but I don't know how to debug it in JS.
The code for the inline class is like this:
I have other fields, but this is the minimum configuration I tried.
If you need further information please let me know.
The text was updated successfully, but these errors were encountered: