A
A
Alexander2016-04-18 12:48:38
Django
Alexander, 2016-04-18 12:48:38

How to connect your library to the template?

There is a self-written library for your project.

......
class Upload:
    ....
    def get_files(self, folder_name, id):
        path = self.get_path(folder_name, id)
        .......
            return images
        else:
            return False
..............

How can I add it to my template now?
something like this:
{% for new in news %}
                        <div class="news">
                            <div class="news-title">{{ new.title }}</div>
                                {{ new.short_text }}
                         {{ Upload.ge_files('news', new.id}}
                    {% endfor %}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2016-04-18
@kentuck1213

Custom filter or tag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question