You need to write a template tag which will make use of the num2words library to convert the cash to words and apply it in your template.
-- Lets say your template tag name is num2word, You can apply it in your template like {{ payment.cash|num2word }}
On Sunday, 28 January 2018 22:02:54 UTC+5:30, Ariel Matysiak wrote:
On Sunday, 28 January 2018 22:02:54 UTC+5:30, Ariel Matysiak wrote:
Hello :)It's my first post in here.I've made simple model and simple app.I want to use num2words library and I want to see my "cash" i words.I don't know how to do it/Can you help me ???Please edit code for me.------------------------------------------- models.pyclass Payment(models.Model):name = models.CharField(max_length=20) cash = models.IntegerField()def __str__(self):return self.name------------------------------------------------ views.pyclass PaymentListView(ListView):model = Payment--------------------------------------------- template.html----------------------------------------------- forms.pyclass PaymentForm(forms.ModelForm):class Meta:model = Paymentfields = ('name','cash')THANK YOU VERY MUCHAriel
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eb338c90-57da-4bb2-9693-3d8843ba3642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment