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

Error while adding tags. ( First select a department. ) #8

Open
virendracis opened this issue Jul 31, 2024 · 3 comments
Open

Error while adding tags. ( First select a department. ) #8

virendracis opened this issue Jul 31, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@virendracis
Copy link

image

@DjangoCRM
Copy link
Owner

DjangoCRM commented Jul 31, 2024

Hi! Usually tags in crm app are created by regular users (sales managers). In this case, their department is assigned to the tag automatically.
But now you are logged into the site as a superuser.
To be able to access materials from all departments, the superuser may have a state of no assigned department.
Therefore, to create a tag, you first had to select a department (in the right sidebar).

To avoid this situation, we can dynamically add a department select field to this view.
This can be done in get_form method of TagAdmin.
If the current user's department is not specified (request.user.department_id),
then use the widget forms.Select() for the "department" field (form.base_fields['department'].widget)
else forms.HiddenInput().
After making changes, don't forget to run the tests.

@DjangoCRM DjangoCRM added the good first issue Good for newcomers label Jul 31, 2024
@Hrishabh598
Copy link
Contributor

Hello there, i think i can make it work by your suggestion. Can you please assign it to me?

@DjangoCRM DjangoCRM assigned DjangoCRM and Hrishabh598 and unassigned DjangoCRM Sep 12, 2024
@DjangoCRM
Copy link
Owner

Hi! Sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants