@register.tag
def get_object_models(parser, token):
    """
    USAGE:
    {% load get_objects %}
      {% get_object_models "APP_NAME" "MODEL_NAME" "SORT" "NUMBER OF ITEMS" "VARIABLE_NAME"
      Then iterate through

    EXAMPLE:
    {% load get_objects %}
      {% get_object_models "django_yaba" "Story" "-created" "3" "blog_posts" %}
        <ul>
        {% if blog_posts %}
          {% for post in blog_posts %}
            <li><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></li>
          {% endfor %}
        {% endif %}
    """
    try:
        tag_name, app_name, model_name, sort, count, var_name = token.split_contents()
    except __HOLE__:
        raise template.TemplateSyntaxError("Object Tag requires 5 variables")

    return ModelObjectNode(app_name[1:-1], model_name[1:-1], sort[1:-1], count[1:-1], var_name[1:-1])
dataset/ETHPy150Open f4nt/djtracker/djtracker/templatetags/get_objects.py/get_object_models