-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a send-usage-report button in the django admin
- Loading branch information
1 parent
0ad1b5f
commit 73ef3ff
Showing
6 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.15 on 2024-10-25 19:31 | ||
|
||
from django.db import migrations | ||
from django.contrib.auth.models import Group | ||
|
||
|
||
def create_billing_team_group(apps, schema_editor): | ||
Group.objects.get_or_create(name="Billing Team") | ||
|
||
|
||
def reverse_create_billing_team_group(apps, schema_editor): | ||
Group.objects.filter(name="Billing Team").delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("posthog", "0499_hog_function_type"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_billing_team_group, reverse_create_billing_team_group), | ||
] |
11 changes: 11 additions & 0 deletions
11
posthog/templates/admin/posthog/organization/change_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% extends "admin/change_list.html" %} | ||
{% load i18n admin_urls %} | ||
|
||
{% block object-tools-items %} | ||
{% if show_usage_report_button %} | ||
<li> | ||
<a href="{% url 'admin:send-usage-report' %}">Send Usage Report</a> | ||
</li> | ||
{% endif %} | ||
{{ block.super }} | ||
{% endblock %} |
21 changes: 21 additions & 0 deletions
21
posthog/templates/admin/posthog/organization/send_usage_report.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends "admin/base_site.html" %} | ||
{% load i18n admin_urls %} | ||
|
||
{% block content %} | ||
<div id="content-main"> | ||
<form method="post"> | ||
{% csrf_token %} | ||
<fieldset class="module aligned"> | ||
{% for field in form %} | ||
<div class="form-row"> | ||
{{ field.errors }} | ||
{{ field.label_tag }} {{ field }} | ||
</div> | ||
{% endfor %} | ||
</fieldset> | ||
<div class="submit-row"> | ||
<input type="submit" value="Send Usage Report" class="default" name="_send_report"> | ||
</div> | ||
</form> | ||
</div> | ||
{% endblock %} |