mirror of
https://github.com/Labelbase/Labelbase.git
synced 2026-08-18 13:09:04 +02:00
.
This commit is contained in:
parent
50ccbb7b70
commit
4ea2989f28
3 changed files with 19 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
import jsonfield
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ class Labelbase(models.Model):
|
|||
blank=True
|
||||
)
|
||||
about = models.CharField(
|
||||
max_length=200,
|
||||
max_length=200,
|
||||
default="",
|
||||
blank=True
|
||||
)
|
||||
|
|
@ -27,8 +27,8 @@ class Label(models.Model):
|
|||
TYPE_ADDR = 'addr'
|
||||
TYPE_PUBKEY = 'pubkey'
|
||||
TYPE_INPUT = 'input'
|
||||
TYPE_OUTPUT = 'output'
|
||||
TYPE_XPUT = 'xpub'
|
||||
TYPE_OUTPUT = 'output'
|
||||
TYPE_XPUT = 'xpub'
|
||||
|
||||
TYPE_CHOICES = [
|
||||
(TYPE_TX, 'tx'),
|
||||
|
|
@ -55,5 +55,3 @@ class Label(models.Model):
|
|||
)
|
||||
data = jsonfield.JSONField()
|
||||
labelbase = models.ForeignKey(Labelbase, on_delete=models.CASCADE)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.views.generic.list import ListView
|
|||
from two_factor.views import OTPRequiredMixin
|
||||
from two_factor.views.utils import class_view_decorator
|
||||
|
||||
from labelbase.models import Label
|
||||
from labelbase.models import Label, Labelbase
|
||||
|
||||
class HomeView(TemplateView):
|
||||
template_name = 'home.html'
|
||||
|
|
@ -15,13 +15,15 @@ class HomeView(TemplateView):
|
|||
|
||||
class LabelbaseView(ListView):
|
||||
template_name = 'labelbase.html'
|
||||
context_object_name = 'label_list'
|
||||
context_object_name = 'label_list'
|
||||
def get_queryset(self):
|
||||
labelbase_id = self.kwargs['labelbase_id']
|
||||
qs = Label.objects.filter(labelbase__user_id=self.request.user.id, labelbase_id=labelbase_id)
|
||||
qs = Label.objects.filter(labelbase__user_id=self.request.user.id, labelbase_id=self.kwargs['labelbase_id'])
|
||||
return qs.order_by("-id")
|
||||
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(LabelbaseView, self).get_context_data(**kwargs)
|
||||
context['labelbase'] = Label.objects.get(id=self.kwargs['labelbase_id'], user_id=self.request.user.id)
|
||||
return context
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,18 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div style="padding-top: 1em;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col float-start">
|
||||
<h2>{% block title %}LazyTiger {% endblock %}</h2>
|
||||
<h2>{% block title %}{{ labelbase.name }} {% endblock %}</h2>
|
||||
<tt>{{ labelbase.fingerprint }} </tt>
|
||||
{% if about.about %}
|
||||
<p>{{ about.about}} </p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col float-end" >
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue