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

Deployment 🚑 #349

Merged
merged 23 commits into from
Apr 12, 2021
Merged

Deployment 🚑 #349

merged 23 commits into from
Apr 12, 2021

Conversation

ddabble
Copy link
Member

@ddabble ddabble commented Apr 12, 2021

Brings in the changes from the following PRs:

zootos and others added 23 commits March 5, 2021 12:24
Small features for internal members list
Also fixed the email field not displaying the emails in a monospace font.
In general, it's not a very good idea to limit the number of characters a user can input, as it's surprisingly often too short compared to real data. In addition to this, some SQL database systems (like SQLite and PostgreSQL) actually implement fixed-length and unlimited-length text/char fields the same way, so there isn't any performance impact choosing `TextField` over `CharField`.

Regarding `blank=True`, this argument should (in most cases) be added to fields that are either nullable or have a default value (the default value of `TextField`/`Charfield` is in practice always the empty string, even though it isn't technically the default value if not explicitly specified).

Also removed `null=True` on string-based fields (see https://docs.djangoproject.com/en/3.1/ref/models/fields/#null on why).

Added `UnlimitedCharField` (which is a `TextField` in disguise) and `URLTextField`, for convenience.
Added an `AlterField` for `Quota.machine_type` that removes `null=True` and `blank=True`, and for `MachineType.name` that removes `max_length`, both of which were missing in the last migration (`0015_machinetype`) - added in 4dc6e64.

Also corrected the type of `MachineType`'s `ordering` option from a list to a tuple in the migration that added it. This was also mistakenly not included in the commit mentioned above.
* In apps' `urls.py` files, importing every single view makes the number of imports quickly get out of hand
* `ugettext_lazy` is deprecated in favor of `gettext_lazy`
* Removed importing `InheritanceGroup` as `Group` in `groups/tests.py`, as it can be very confusing when most people (typically) are used to the actual model name. The same goes for this line in `test_reservation_rules.py`:
    `self.period = ReservationRule.Period`
* Renamed `AnnouncementType` to `Type`
* Made `UserSkill.LEVEL_CHOICES` into an `IntegerChoices` enum: `Level`
* Made the following tuples into `TextChoices` enums:
  * `Printer3DCourse.STATUS_CHOICES`: `Status`
  * `Machine.STATUS_CHOICES`: `Status`
  * `Event.EVENT_TYPE_CHOICES`: `Type`
  * The `choices` argument of `EventTicket.language`: `Language`
* Creating a custom queryset class and using it as a manager (`QuerySet.as_manager()`) is more flexible than just creating a manager (see https://docs.djangoproject.com/en/3.1/topics/db/managers/#creating-a-manager-with-queryset-methods)
* [announcements/templatetags] Added missing `__init__.py`
* Registering template tags and filters is cleaner without any parentheses or arguments (for filters, the filter function's name is used in the templates if none is specified, so no need for the `name` argument)
* Renamed jQuery variables to start with a `$`
* [checkin/admin.py] `ModelAdmin` classes have no `model` field
* The `type` attribute on `<script>` tags is superfluous to specify (when the linked script is JavaScript), as `application/javascript` is default; the same goes for the `type` attribute on `<link>` tags (when `rel="stylesheet"` and the linked file is CSS)
* [checkin/suggest_skill.html] Removed the `required` of the skill image form input, as the model doesn't require an image
* [checkin/suggest_skill.html] Replaced calls to `parents()` with `closest()`, to not potentially remove more elements than intended
* Using the `autoescape off` template tag is equivalent to using the `safe` template filter
* [groups/admin.py] Replaced `@admin.register()` annotation with calling `admin.site.register()`, which is the convention in this project
* [groups/committee_admin.html] Removed unused code (that was likely copy-pasted from `admin_event_detail.html`)
* [internal/forms.py] Specifying `fields = "__all__"` when the `exclude` field is present, is unnecessary
* [internal/member_list.js + internal/member_list.html] Made the `member-` IDs camelCase (like `study-program` -> `studyProgram`), to facilitate refactoring
* [internal/member_list.js] Added `$.trim()` around the data attributes, to facilitate setting them with values containing extra whitespace (see the changes in `member_list.html`)
* [internal/member_list.html] Removed the `if` tag around `member.email`, as if the member has no email, the value will be the empty string; same goes for `member.term_quit`, except that the value will be `None`, which is why the `default:""` filter was added; the same also goes for `member.date_quit`, except that there will be thrown an exception when calling the `date` filter on a `None` value, which will implicitly be ignored silently and leads to no value (the empty string) being inserted
* Removed `{{ block.super }}` (and the misspelled `{{ super.block }}`) when the super template's block is empty
* [internal/views.py] Removed the `delete()` method of `DeleteSecretView`, as all it did was call the super method
* [make_queue/converters.py] Removed the unused `Date` and `DateTime` converters
* [make_queue/forms.py] Added a missing return statement in the `save()` methd of `Printer3DCourseForm`
* [make_queue/machine_detail.css] Removed some unused selectors
* [make_queue/reservation_edit.js] Added a declaration of `maximumDay` at the top of the script, to make it clear that it's defined elsewhere (it's still defined in `reservation_edit.html`)
* [make_queue/reservation_edit.js + quota_edit.html] Added constants with commonly used jQuery selectors
* [make_queue/reservation_extra.py] Removed `timezone.now()` as argument to `timezone.localtime()`, as it's the default value
* [make_queue/test_reservation_extra.py] Removed unnecessarily saving `user` right after creating it
* [make_queue/test_reservation_reservation.py + news/tests.py] Added explicit kwargs, to make the arguments more understandable
* [make_queue/urls.py] Removed registering the converters removed in `make_queue/converters.py`
* [makerspace/admin.py] Replaced setting `ordering` with calling `default_order_by()`, as it reduces code duplication, and works even if `priority` is `None`
* [makerspace/equipment_detail.html] Removed the unused `admin-page` block
* [makerspace/equipment_list.html] Removed the unused `image_link.js` script link
* [news/forms.py] Specifying `exclude = []` when the `fields` field is present, is unnecessary
* [news/admin_list.css + news/admin_event_detail.css] Removed the unused `.makeicon` selector
* [news/email/ticket.html] Added the missing `lang` attribute to the `<html>` tag
* [news/admin_article_list.html] Removed the unused `news_tags`
* [news/timeplace_edit.html] Removed linking unused CKEditor scripts
* [news/views.py] Added `context_object_name`, to set a more fitting name than `object` to the template context variables
* [news/views.py] Removed superfluous calls to `all()` after calling `order_by()` (or any other queryset method, for that matter)
* [web/style.css] Removed some unused selectors
* [web/style.css] Moved the `.display-none` (renamed from `.make_hidden`) selector from some other files to here
* [web/admin_panel.html] Removed `or user.is_superuser`, as all superusers implicitly have all permissions
* [web/footer.html] Fixed the outdated MazeMap URL; it should now be more long-lived when using the `360-BU1-124` ID
* [web/views.py] Removed the unused `makerspace.change_makerspace` permission
* [make_queue/admin.py] Replaced setting `ordering` with calling `default_order_by()`, as it reduces code duplication, and works even if `priority` is `None`.
Fixed missing user info when creating new account 🚑
@ddabble
Copy link
Member Author

ddabble commented Apr 12, 2021

Merging without approval, for the same reason as this comment states.

@ddabble ddabble merged commit 4f7197a into master Apr 12, 2021
@mahoyen mahoyen added the deployment Pull requests from another branch (usually `dev`) into the `main` branch label Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Pull requests from another branch (usually `dev`) into the `main` branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants