Adding tab to model via plugin #15720
Answered
by
markkuleinio
ziggekatten
asked this question in
Help Wanted!
-
Beta Was this translation helpful? Give feedback.
Answered by
markkuleinio
Apr 15, 2024
Replies: 2 comments 4 replies
-
If you can make a small self-contained plugin which demonstrates this behaviour (e.g. display a static page instead of making an API call), then:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I will try to make a full public example later, the rough steps for now (this is for Prefix but anyway): Template: {% extends 'generic/object.html' %}
{% block content %}
My content
{% endblock content %} View: @register_model_view(Prefix, name="mytab")
class HelloWorldView(View):
tab = ViewTab(
label="My Tab",
permission="ipam.view_prefix",
)
def get(self, request, pk):
prefix = Prefix.objects.get(pk=pk)
return render(
request,
"my_plugin/tab.html",
{
"object": prefix,
"tab": self.tab,
},
) Comments:
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
ziggekatten
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I will try to make a full public example later, the rough steps for now (this is for Prefix but anyway):
Template:
View:
Comments:
context["object"]
is needed to be able to populate the …