Project

Profile

Help

Story #6500

closed

Add modelresource to plugin-template

Added by ggainey almost 4 years ago. Updated over 3 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

It would be good for the plugin-template to include creating a /app/modelresource.py file to help plugin authors play the import/export game. Such a modelresource would have a class defined for everything in models.py or models/, using the following template:

from pulpcore.app.modelresource import QueryModelResource                                    
from PLUGIN.app.models import (                                                            
    <list models here>,                                                  
)                                                                                            
    

class MODELResource(QueryModelResource):                                          
    """                                                                                      
    Resource for import/export of plugin-type_modelname entities.                             
    """                                                                                      
                                                                                             
    def set_up_queryset(self):                                                               
        """                                                                                  
        :return: MODELs specific to a specified repo-version.                     
        """                                                                                  
        return MODEL.objects.filter(pk__in=self.repo_version.content)             
                                                                                             
    class Meta:                                                                              
        model = MODEL    

IMPORT_ORDER = [                                                                             
    MODEL-list-in-alfa-order,                                                                                                                                     
]     
Actions #1

Updated by daviddavis over 3 years ago

  • Parent issue deleted (#6134)

Detaching from epic.

Actions #2

Updated by dkliban@redhat.com over 3 years ago

  • Status changed from NEW to CLOSED - WONTFIX

We will not get to this any time soon. Let's revisit when we have time.

Also available in: Atom PDF