Avatar ·

Using __init__.py in modern code

📁 Advanced Python Topics

Is it necessary in modern code to add a __init__.py file to a directory from which you plan to import modules? Or is it sufficient to use implicit namespace packages?

Avatar ·

In a template, you can use a loop within <select><option> tags to place the necessary information from fields, and then connect a library for a nice multiselect.

<select class=""yourclass"" multiple="""" name=""youame"" required="""" id=""yourselectid"">   {% for m in model_context %}      <option value=""{{ m.somevalue }}"">{{ m.somename }}</option>  {% endfor %}</select>

In your custom .js file, you can manipulate this element by referencing the id parameter of the tag.

Log in to leave an answer

Blogs