Coder Social home page Coder Social logo

Comments (7)

maxtepkeev avatar maxtepkeev commented on July 27, 2024

As for the

issue = redmine.issue.new()
issue.project_id = 'lsdt'
issue.subject = 'Test 1'
issue.save()

I can confirm that this is a bug in Python Redmine and it will be fixed in the next release. Thanks for reporting this.

As for the custom fields, you are using it incorrectly, there is example in the docs:

issue = redmine.issue.create(
    project_id='lsdt',
    subject='Test 1',
    custom_fields=[{'id': TESTFIELD_ID, 'value': TESTFIELD_VALUE}]
)

I.e. you should use the id of the custom field and not a name to set it's value, exactly like in the example.

from python-redmine.

tardis4500 avatar tardis4500 commented on July 27, 2024

Ah, I see. Thanks for the info. As a suggestion, begin able to pass in a simple dictionary for custom_fields as with custom_fields={'field': 'val'} in addition to a list as now would be a good enhancement and IMHO more Pythonic.

Thanks!

from python-redmine.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

I'm using a list here because you might want to set several fields at once and not one. Of course I can add a check that if a dictionary is passed then we can assume that a single custom field should be set and we should wrap it in a list (Redmine requires a list even if a single custom field is set), but that will create inconsistency from the user point of view imho.

Also, if I am not mistaken it is impossible to set a custom field via it's name, that's why I'm using an id here, but I'll check it to be sure, and if it's possible I will add such a functionality in Python Redmine.

Anyway, thanks for the suggestion.

from python-redmine.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

Problem with the issue creation via new() method is fixed in f127314. It will be released to PyPI a little bit later, if you need a fix right now you can always install the latest development version from Github via pip.

from python-redmine.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

I've also checked custom fields, and as I expected, the only way to set them is via id.

from python-redmine.

tardis4500 avatar tardis4500 commented on July 27, 2024

How do I find out what the ID is for a custom field?

from python-redmine.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

If you are using Redmine >= 2.4.0 you can issue an API request via redmine.custom_field.all() and it will return all the available custom fields with their ids.

For Redmine <= 2.4.0 you can go to http://your-redmine-server/custom_fields and click on the custom field you are interested in, then have a look at the browser address bar, there will be an id of the custom field, e.g. http://your-redmine-server/custom_fields/9/edit, 9 is the id of the custom field.

You need to login with a user that has administrative privileges to get access to custom fields.

from python-redmine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.