Skip to content

Move has_duplicate functionality to Media base class - #2019

Merged
johannaengland merged 1 commit into
mainfrom
destinations/has-duplicate
Aug 4, 2026
Merged

Move has_duplicate functionality to Media base class#2019
johannaengland merged 1 commit into
mainfrom
destinations/has-duplicate

Conversation

@johannaengland

Copy link
Copy Markdown
Contributor

Scope and purpose

Very similar to #2015. Basically copied from #936.

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation, including updates to the user manual if feature flow or UI is considerably changed
  • Linted/formatted the code with ruff and djLint, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See our how-to
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this results in changes to the database model: Updated the ER diagram

Using the new MEDIA_SETTINGS_KEY we simplify the media
@johannaengland
johannaengland requested review from a team and hmpf August 3, 2026 12:48
@johannaengland johannaengland self-assigned this Aug 3, 2026
@johannaengland johannaengland added nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) media-plugin destination All things DestinationConfig labels Aug 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.02%. Comparing base (7ef8415) to head (72b7761).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2019      +/-   ##
==========================================
+ Coverage   88.97%   89.02%   +0.05%     
==========================================
  Files         155      155              
  Lines        7339     7329      -10     
==========================================
- Hits         6530     6525       -5     
+ Misses        809      804       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johannaengland

Copy link
Copy Markdown
Contributor Author

I noticed when testing this that if I try to add a duplicate destination I get the following error:

2026-08-03 14:40:21,535 django.request ERROR    Internal Server Error: /notifications/destinations/create/
Traceback (most recent call last):
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/django/views/generic/edit.py", line 182, in post
    return super().post(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/django/views/generic/edit.py", line 151, in post
    return self.form_valid(form)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/johanna/Argus/src/argus/htmx/destination/views.py", line 101, in form_valid
    form.save()
  File "/home/johanna/Argus/src/argus/htmx/destination/forms.py", line 39, in save
    self.serializer.save(user=self.request.user)
  File "/home/johanna/Argus/.venv/lib/python3.12/site-packages/rest_framework/serializers.py", line 182, in save
    assert not self.errors, (
           ^^^^^^^^^^^^^^^
AssertionError: You cannot call `.save()` on a serializer with invalid data.
2026-08-03 14:40:21,538 django.server INFO     "POST /notifications/destinations/create/ HTTP/1.1" 200 655

I will work on fixing that in a follow up issue, since this error already exists on main

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Test results

    8 files  1 792 suites   3m 17s ⏱️
1 005 tests 1 004 ✅ 1 💤 0 ❌
8 040 runs  8 032 ✅ 8 💤 0 ❌

Results for commit 72b7761.

@johannaengland
johannaengland merged commit d58269a into main Aug 4, 2026
22 checks passed
@johannaengland
johannaengland deleted the destinations/has-duplicate branch August 4, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

destination All things DestinationConfig media-plugin nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants