Skip to content

Cleanup personal #130

Merged
merged 19 commits into from
Feb 9, 2025
Merged

Cleanup personal #130

merged 19 commits into from
Feb 9, 2025

Conversation

donald
Copy link
Member

@donald donald commented Feb 9, 2025

Cleanup personal.models:

  • Downgrade groups and position from explicit through to to simple ManyToManyFields without ClusterableModel
  • Simplify personal admin panels
  • Change layout of contact list
  • Remove dead code and unused db data
  • misc cleanups

In 50dd4a6 ("contactlist: Add selector
for Position and Special Function") we remove the only user of this
method. Remove dead code.
Fix table header for groups

Fixes ef3b68f ("Multiple positions per
contact")
Create migrations with

    ./manage.py makemigrations

Note, that the new migration doesn't actually change the database
scheme:

buczek@theinternet:~/git/mpicms (progress)$ ./manage.py sqlmigrate personal 0028
DEBUG 2025-02-08 20:08:42,206 asyncio Using selector: EpollSelector
BEGIN;
--
-- Change Meta options on group
--
--
-- Change Meta options on position
--
--
-- Change Meta options on specialfunction
--
--
-- Change Meta options on status
--
COMMIT;
We want to split responsibilities for defining positions and assigning
contacts to position. Therefore we no longer want the positions inline
panel in the contact model admin.

Make positions into a simple ManyToMany field.

Add sql code to autogenerated migration to transfer data from the old
through table "personal_contactpositions" to the new one
("personal_contact_positions").

Adapt queries.
We want to reference Group from Contact in the following commit, so move
the class in the source file.
We want to split responsibilities for defining groups and assigning
groups to position. Therefore we no longer want thegroupspositions inline
panel in the contact model admin.

Make groups into a simple ManyToMany field.

Add sql code to autogenerated migration to transfer data from the old
through table "personal_contactgroups" to the new one
("personal_contact_groups").

Adapt queries.
We no longer need modelcluster for Groups and Contact, as they are
edited seperately. Downgrade base class from
modelcluster.models.ClusterableModel to django.db.models.Model
Fixes 50dd4a6 ("contactlist: Add
selector for Position and Special Function")
Use FieldsPanels inside a single MutiFieldPanel, because this is a bit
compacter. Rearrange order. Intentionally skip "status" for now as the
usage is not yet clear and no choices are defined.
Only Contact is used as snippet, but not Positon or Group, so remove
the @register_snippet decorator.
Change default string representation from "Dr. Henry Jeckyl" to "Jekyll,
Henry".

Add property method "name" to return the same representation.

Add property name_and_title to return name with title(s) included
("Jekyll, Dr. Henry, PhD MD")
Save vertical space by combining names and titles into one column.
Remove title column from Contact admin list view and rearrange the other
columns.
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant