Skip to content

Conversation

@danickfort
Copy link
Contributor

The 'module' that the permissions belong to is named 'scheduler', not 'django-tasks-scheduler'.

Fixing this allows staff users that have any scheduler permission (aka, they have the 'module permission') to see the Queues and Workers admin pages.

The 'module' that the permissions belong to is named 'scheduler', not 'django-tasks-scheduler'.

Fixing this allows staff users that have any scheduler permission (aka, they have the 'module permission') to see the Queues and Workers admin pages.
@DhavalGojiya DhavalGojiya self-requested a review October 13, 2025 16:33
@cunla
Copy link
Member

cunla commented Oct 13, 2025

Would it be possible to write a test for this?

@danickfort
Copy link
Contributor Author

danickfort commented Oct 14, 2025

Would it be possible to write a test for this?

I wrote a couple of tests. Can't run them locally at the moment, let me know if they need adjustments.

@DhavalGojiya
Copy link
Member

DhavalGojiya commented Oct 15, 2025

Would it be possible to write a test for this?

I wrote a couple of tests. Can't run them locally at the moment, let me know if they need adjustments.

How to Run This Test Cases

cd testproject
uv run python manage.py test scheduler.tests.test_admin_permissions

Example output:

Found 2 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..
----------------------------------------------------------------------
Ran 2 tests in 1.203s

OK
Destroying test database for alias 'default'...

The scheduler package path is already included in sys.path, and live editing is supported since this is an editable project.

PS: Your test cases looks good and passes, If I change the code as shown below:

- return request.user.has_module_perms("scheduler")
+ return request.user.has_module_perms("django-tasks-scheduler")

the test case starts failing - which means the test is correctly verifying the intended code scenario.

Everything looks good, but I have a doubt about the placement of this test case. Is it fine as it is @cunla, or should the test case be placed in some other file or directory?

@DhavalGojiya DhavalGojiya requested a review from cunla October 15, 2025 09:55
@cunla cunla merged commit ac07187 into django-commons:master Oct 15, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants