koleror / django-admin-views

Easily link custom admin views and direct URLs into the Django admin
BSD 3-Clause "New" or "Revised" License
187 stars 33 forks source link

Duplicated admin views links in admin #32

Open PleiadiBot opened 7 years ago

PleiadiBot commented 7 years ago

Trying the example in the REDME, I'm experiencing some problem.

I get duplicated links in the admin dashboard for the admin_views. screen shot 2017-07-21 at 11 02 57

this is my admin class

class TestAdmin(AdminViews):
    admin_views = (
        ('Redirect to CNN', 'redirect_to_cnn'),
        ('Go to revsys.com', 'http://www.revsys.com'),
    )

    def redirect_to_cnn(self, *args, **kwargs):
        return redirect('http://www.cnn.com')

admin.site.register(TestModel, TestAdmin)

This admin is a part of a big project with a lot of customization so it's probably a bad scenario to use as a test but I noticed that everything works good by resetting the output_urls property (self.output_urls = []) at the top of the grt_urls method:


def get_urls(self):
        original_urls = super(AdminViews, self).get_urls()
        added_urls = []
        self.output_urls = []

Do you think it's ok for a PR

koleror commented 2 years ago

Hi, Just took over the project. Can't reproduce. Can you try again?