Skip to content

Unable to edit existing contracts with custom contract_type value #420

@WillNawate

Description

@WillNawate

Environment

  • Python version: 3.11.11
  • Nautobot version: 2.4.2
  • nautobot-device-lifecycle-mgmt version: 2.2.1

Expected Behavior

The contract_type field on ContractLCM model is a CharField, is possible to assign any value to it through the backend or API.
It is expected to be able to edit and save the object over the Web UI, and also be able to choose a existing contract_type value when trying to add new contracts.

Observed Behavior

When trying to edit a contract over the Web UI, is not possible to save it if the contract has contract_type different from "Hardware" or "Software" as these are the only choices available to choose from.

Since the "Contract Type" field is required by the form, the only way to save the contract is by changing the contract_type to one of the two values provided by the ContractTypeChoices class.

Same thing occurs when trying to add a new contract, is not possible to choose a existing value different from the ones provided.

Steps to Reproduce

  1. Add a contract with a custom contract_type value over the API
  2. Try to edit the newly created contract, the "Contract Type" field will show as "---------"
  3. Try to save the object and the form will complain that no value was choose for the "Contract Type" field

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedtype: featureIntroduction of substantial new functionality to the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions