Skip to content
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

PR for issue 28 #33

Merged
merged 30 commits into from
May 3, 2023
Merged

PR for issue 28 #33

merged 30 commits into from
May 3, 2023

Conversation

mpibpc-mroose
Copy link
Contributor

I wrote a proof of concept for implementing responsive tables for Bootstrap v4 and v5. Basically the goal was to use another base template from django-tables2. To make it DRY I needed to introduce some partials and move some of the code out of the templates for re-use.

Roughly tested it in my projects and it completely does fulfill my needs.

@djk2
Copy link
Owner

djk2 commented Apr 18, 2023

I have also one general request.
In repository exist also the testproject where you can in quick way launch demo project to test how library works.
Can you also extend this demo project to show how lib works in "responsive" mode.
In testproject on "index/home" page user can choice a version of bootstrap from 2 to 5. (blue buttons),
I suggest add 2 more buttons for boostrap4-responsive and boostrap5-responsive
What do you think ?

image

On this occasion you can also change a button layout from horizontal to vertical.
You know :) when I started working on this library I had only 2 versions (buttons) of bootstrap.
Now there is a five buttons - it will be better to display them in vertical stack.

@djk2
Copy link
Owner

djk2 commented Apr 18, 2023

Can you also increase the version of library in django_tables2_column_shifter/__init__.py from 2.1.1 to 2.2.0 and add a note in CHANGELOG.rst describing changes for this version. ?

@mpibpc-mroose
Copy link
Contributor Author

Should be all resolved now.

@mpibpc-mroose mpibpc-mroose requested a review from djk2 April 19, 2023 10:47
@djk2
Copy link
Owner

djk2 commented Apr 26, 2023

Can you fix the tests?
To run test locally you can execute command
tox -r --workdir /tmp/tox-dir
At now, tests returning error:

django.template.exceptions.TemplateDoesNotExist: django_tables2/bootstrap4-responsive.html   

To code I do not have more comments.

@mpibpc-mroose
Copy link
Contributor Author

That's pretty interesting. I'm relying on a template from django-datatables2 which seemed to have introduced in the 2.5 versions (django_tables2/bootstrap{4,5}-responsive.html). I wasn't aware of this. And it makes it pretty difficult for me to decide how to proceed as I was building anything around that.

I'm pretty unsure how to proceed. Any advice?

@djk2
Copy link
Owner

djk2 commented Apr 27, 2023

Give me some time to consider how solve it.
I will try to look on that tomorrow

django_tables2_column_shifter/tests/test_base.py Outdated Show resolved Hide resolved
django_tables2_column_shifter/tests/test_base.py Outdated Show resolved Hide resolved
django_tables2_column_shifter/tests/test_base.py Outdated Show resolved Hide resolved
CHANGELOG.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
django_tables2_column_shifter/tests/test_base.py Outdated Show resolved Hide resolved
django_tables2_column_shifter/tables.py Show resolved Hide resolved
django_tables2_column_shifter/tables.py Show resolved Hide resolved
django_tables2_column_shifter/tables.py Show resolved Hide resolved
django_tables2_column_shifter/tables.py Show resolved Hide resolved
@djk2
Copy link
Owner

djk2 commented Apr 28, 2023

That's pretty interesting. I'm relying on a template from django-datatables2 which seemed to have introduced in the 2.5 versions (django_tables2/bootstrap{4,5}-responsive.html). I wasn't aware of this. And it makes it pretty difficult for me to decide how to proceed as I was building anything around that.

I'm pretty unsure how to proceed. Any advice?

Hi.
I added suggestions to code.
Changes are not vast.
I proposed to add a exclusions and inform users that they can use new features only for some of versions of django-tables2.
I included changes in tests.
You have also fix the pep8.

./django_tables2_column_shifter/tests/urls.py:3:101: E501 line too long (109 > 100 characters)
./testproject/testproject/urls.py:21:101: E501 line too long (102 > 100 characters)
./testproject/testproject/urls.py:24:101: E501 line too long (102 > 100 characters)

mpibpc-mroose and others added 8 commits April 28, 2023 10:46
…es2-column-shifter

# Conflicts:
#	CHANGELOG.rst
#	README.rst
#	django_tables2_column_shifter/tables.py
#	django_tables2_column_shifter/templates/django_tables2_column_shifter/_partials/bootstrap4_table_block.html
#	django_tables2_column_shifter/templates/django_tables2_column_shifter/bootstrap4-responsive.html
#	django_tables2_column_shifter/tests/test_base.py
#	django_tables2_column_shifter/tests/urls.py
@mpibpc-mroose mpibpc-mroose requested a review from djk2 April 28, 2023 14:14
@@ -12,7 +12,9 @@
ColumnShiftTableBootstrap2,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please import dt_version from django_tables2_column_shifter.tables you added it there.

'max_dt_version': None,
'template_name': 'django_tables2_column_shifter/bootstrap5-responsive.html',
'table_clsss': ColumnShiftTableBootstrap5Responsive,
},
]

dt_version = tuple(map(int, tables.__version__.split(".")[:2]))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove dt_version from here and import it from django_tables2_column_shifter.tables at top of file.
After yesterday changes we already have dt_version in tables
Moreover, now you need version containing 3 digits instead 2.

)
from django_tables2_column_shifter.tables import dt_version
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this import between 11 and 12 line.
Above package tables is already imported from django_tables2_column_shifter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your absolutely right!

@djk2 djk2 merged commit 92a49e6 into djk2:master May 3, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants