Skip to content

Commit

Permalink
fixed avatars and added assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Prikhno committed Jun 9, 2023
1 parent 82046e2 commit 5e6f147
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 2 deletions.
Binary file added assets/images/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/register.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/tip_waiter1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/waiter1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tips/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ def save(self, commit=True):

class TipForm(forms.Form):
rub_amount = forms.IntegerField(label="rub_amount")
comment = forms.CharField(max_length=200)
2 changes: 1 addition & 1 deletion tips/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __str__(self):
class Transaction(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
customer = models.ForeignKey(Customer, on_delete=models.CASCADE) # TODO: do not delete transactions
waiter = models.ForeignKey(Waiter, on_delete=models.CASCADE)
waiter = models.ForeignKey(Waiter, on_delete=models.CASCADE) # TODO: store addresses? in case of change
datetime = models.DateTimeField(auto_now=True)
amount = models.PositiveBigIntegerField()
comment = models.CharField(max_length=200)
Expand Down
2 changes: 2 additions & 0 deletions tips/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ <h1 class="title" style="color: ghostwhite;">🌿 PEKOE</h1>
{% if request.user.is_authenticated %}
<span class="navbar-item">
<a class="image is-32x32" href="{% url 'tips:user' user.username %}">
{% if user.avatar %}
<img class="is-rounded" src="{{ user.avatar.url }}">
{% endif %}
</a>
</span>
<span class="navbar-item">
Expand Down
3 changes: 2 additions & 1 deletion tips/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def waiterview(request, cafe_slug, waiter_username):
form = TipForm(request.POST)
if form.is_valid():
rub_amount = form.cleaned_data.get('rub_amount')
comment = form.cleaned_data.get('comment')
web3client = Web3Client()
# buy rub_amount of PEKOE tokens
buy_status = web3client.buy(request.user.customer.customer_wallet, rub_amount)
Expand All @@ -63,7 +64,7 @@ def waiterview(request, cafe_slug, waiter_username):
return redirect("tips:waiter", cafe_slug=cafe_slug, waiter_username=waiter_username)
# save transaction to db
txn = Transaction(customer=request.user.customer, waiter=waiter,
amount=rub_amount, comment="") # TODO: add comment field
amount=rub_amount, comment=comment)
txn.save(force_insert=True)
# burn and mint tokens from waiter
fiat_status = web3client.exchange_fiat(waiter.waiter_wallet,
Expand Down

0 comments on commit 5e6f147

Please sign in to comment.