Coder Social home page Coder Social logo

filter custom field about python-redmine HOT 2 CLOSED

ds485 avatar ds485 commented on July 27, 2024
filter custom field

from python-redmine.

Comments (2)

maxtepkeev avatar maxtepkeev commented on July 27, 2024

Hi,

Yes, you are right. Unfortunately we can do nothing about it because this is how the custom fields filtering works on the Redmine side and Python Redmine is just the interface for the Redmine API.

So one thing that you can do is to fill a bug report on the Redmine forum and probably they will fix it some day. Until they fix this behaviour you can check the custom field flag to make it work for all projects and not just the specific one(s), this way issue filtering will work as you expect.

Probably another thing you can do is something like

for project in redmine.project.all():
    issues = redmine.issue.filter(project_id=project.id, subproject_id='!*', cf_1="random")
    issue_count = len(issues)

    if issue_count > 0 and issues[0].custom_fields.get(1) is not None:
        print 'Project {0} has {1} issues with custom field with an id of 1'.format(project.name, issue_count)
    else:
        print 'Project {0} has no issues with custom field with an id of 1'.format(project.name)

Of course this is a dirty workaround around the Redmine API behaviour but it should work. Also keep in mind that I haven't check this code but again, it should work.

from python-redmine.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

Sorry there was a logical error in my code. I updated my previous comment with the correct version. Though it's not the complete solution to your problem, e.g. it doesn't check for a specific value for a custom field, but you should get the general idea about how you can accomplish what you need.

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.