19.11.2020       Выпуск 361 (16.11.2020 - 22.11.2020)       Вопросы и обсуждения

Reordering Models - Building SaaS #80

Podcast

Читать>>




Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.

Notes

In this episode, we looked at an UpdateView for the GradeLevel model in the homeschool application. Along the way, I had to display some UI elements on the grade to give users the ability to adjust the ordering of courses within their grade level.

We started by adding the icon link that I wanted to use to give users access to the edit page. Once the link was in place, I created the URL and copied an existing view as a starting point for the UpdateView.

As I got into the development of the UpdateView, I discovered that the template and the form already existed! I had the proper form for a pre-existing CreateView. All I had to add was a bit of context data to conditionally display “Add” vs. “Update” in the UI. I also added a “Cancel” button to the view that was missing before.

Once the view was in place, I wrote all the unit tests to prove that the code worked. I do this because it acts as my safety net for future changes.

The final change that I made was to display a table of courses that the user will be able to move each course up and down. I showed some other up and down movement views from course tasks rather than showing how to implement the movement views during the stream.






Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus