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

Treatment of kind field on JournalEntry is inconsistent #18872

Closed
jeremystretch opened this issue Mar 11, 2025 · 1 comment · Fixed by #18901
Closed

Treatment of kind field on JournalEntry is inconsistent #18872

jeremystretch opened this issue Mar 11, 2025 · 1 comment · Fixed by #18901
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Milestone

Comments

@jeremystretch
Copy link
Member

Deployment Type

NetBox Cloud

NetBox Version

v4.2.5

Python Version

3.10

Steps to Reproduce

  1. View a site and click the "Journal" tab.
  2. Add a journal entry without specifying a kind.

Expected Behavior

The kind field should always be required (AFAICT):

class JournalEntry(...):
    kind = models.CharField(
        verbose_name=_('kind'),
        max_length=30,
        choices=JournalEntryKindChoices,
        default=JournalEntryKindChoices.KIND_INFO
    )

Observed Behavior

The kind field is not required by either the model's form or its REST API serializer.

class JournalEntryForm(NetBoxModelForm):
    kind = forms.ChoiceField(
        label=_('Kind'),
        choices=add_blank_choice(JournalEntryKindChoices),
        required=False
    )
class JournalEntrySerializer(NetBoxModelSerializer):
    kind = ChoiceField(
        choices=JournalEntryKindChoices,
        required=False
    )
@jeremystretch jeremystretch added status: under review Further discussion is needed to determine this issue's scope and/or implementation type: bug A confirmed report of unexpected behavior in the application labels Mar 11, 2025
@jeremystretch jeremystretch changed the title Treatmeant of kind field on JournalEntry is inconsistent Treatment of kind field on JournalEntry is inconsistent Mar 11, 2025
@jeremystretch
Copy link
Member Author

When a journal entry is created via the REST API, its kind defaults to info if not specified, which is expected. The REST API will not permit kind to be empty or null.

However, a journal entry created via the web form can be created with no kind. This needs to be corrected in the form.

@jeremystretch jeremystretch self-assigned this Mar 13, 2025
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Mar 13, 2025
bctiemann added a commit that referenced this issue Mar 19, 2025
…nd-required

Fixes #18872: JournalEntry `kind` is a required field
@jeremystretch jeremystretch added this to the v4.2.6 milestone Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant