I
I
Ivan Soshnikov2014-06-07 23:09:42
C++ / C#
Ivan Soshnikov, 2014-06-07 23:09:42

Django. Reordering records for inline forms?

In the admin panel, you need to set a certain order of entries. For ModelAdmin, I wrote a mixin. It looks something like this:
c7aa59fb2bd14253857fcfc0a7604795.png
I want the same for inlafnovyh forms. The logic there is completely different, so you need to understand and draw a separate solution for them.
However, the task is quite common. Most likely, solutions already exist. It doesn't work to explain to Google what exactly I need - it tries hard to tell me about ordering.
If anyone knows of existing solutions for ordering inline form entries, please leave the links.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2016-01-14
@KirillGo

negative numbers that are greater than -200 are from -200 to 0.
Loop from -200 to zero, sum those that are multiples of 3 (divide by 3 without a remainder).

A
asd111, 2016-01-14
@asd111

#include <iostream>
using namespace std;

int main()
{
    int sum = 0;
    for(int i = - 200 ; i < 0 ; i++ )
    {
    	if( i%3 == 0 ) // Если остаток от деления на 3 равен нулю
    	{
            sum+= i;
    	}
    }
    cout<< sum << endl;
    return 0;
}

S
SilentSokolov, 2014-06-08
@soshnikov

Perhaps this will help . You can also see the code not far away, as well as a separate battery for this case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question