Questions tagged [humanize]

To humanize is to make something friendlier to humans. Humanizing makes things more civilized, refined, and understandable.

37 questions
2
votes
2 answers

How do I set human readable attribute names in a rails model?

This seems like a really simple question -- when I'm using form_for or fields_for helpers to generate markup from my models, how can I modify my model to customize the string that appears for a particular attribute? More or less the same question…
kdt
  • 26,008
  • 26
  • 82
  • 130
2
votes
1 answer

Using humanize to convert numeric into words in rails

I have some amount in numeric for e.g 75.00 and I am trying to convert it into words, for that I used humanize 75.humanize But it keeps throwing error "undefined method humanize error for 75:Float"
Shilpi Agrawal
  • 67
  • 1
  • 11
2
votes
1 answer

Python Number to Word e.g 10K, 10.65M

I've looked into a few ways of representing numbers in a small space (in Django) and whilst their django.contrib.humanize.intword works great, i'd prefer if it said M instead of million for example. I know this wouldn't work with exceptionally large…
Callum
  • 1,104
  • 2
  • 16
  • 36
1
vote
0 answers

Translating humanize text in Django

I have some issues while trying to translate in django (on the front end) So I have a Contact model that has a bunch of messages. Each message has a "contact_date" field which I convert using humanize on the front end. {{ message.contact_date |…
Daniel
  • 111
  • 1
  • 9
1
vote
1 answer

humanize input javascript jquery

I want to title case form inputs using the humanize library and Jquery. So far I have this: $("#FirstName,#LastName").blur(function () { Humanize.titleCase( $(this) ) }); but it gives me an error: humanize.min.js:2 Uncaught TypeError: n.split…
Emrys
  • 17
  • 4
1
vote
1 answer

How translate humanize django

I need translate humanize to portuguese (pt-BR). How? Import: from django.contrib.humanize.templatetags.humanize import naturaltime Using: _question['pub_date'] = naturaltime(question.pub_date) Settings: LANGUAGE_CODE = 'pt-BR' TIME_ZONE =…
Guilherme IA
  • 924
  • 1
  • 14
  • 29
1
vote
3 answers

'd' instead of 'days' in Django naturaltime

I'm workin in a mobile application with DRF as backend and using naturaltime built-in function, but since this is a mobile app, screen space is a big problem (atleast for me). So for an arbitrary date I get: "1 week, 2 days ago" Which is nice, but…
Gocht
  • 8,493
  • 3
  • 31
  • 66
1
vote
1 answer

django ifequal naturalday

I'm not sure why, but this condition will never evaluate True for me. I'm feeding it datetime.today() in the urls file. Am I missing something? Template: {% load humanize %} {{ entry.date|naturalday }} {# Evals to "today" #} {% ifequal…
Scott
  • 2,804
  • 3
  • 29
  • 35
1
vote
1 answer

javascript custom humanize filter

I am stuck with creating custom humanize function for my project. My API is returing labels that I want to turn into more readable such as: probabilityOfDefault and I want to change it into Probability Of Default or historicalDate and change it…
Michał Lach
  • 1,209
  • 4
  • 17
  • 33
0
votes
1 answer

How to humanize measurement queries in Django

I have a distance query in Django and prints a distance with several decimal points. It displays distance in a measurement format as 1023.40258027906 m .I want to make this human readable. I tried using Decimal but this failed as it does not apply…
Kaleab Woldemariam
  • 1,849
  • 3
  • 14
  • 32
0
votes
0 answers

How to make humanize work with crispy forms?

I am trying to humanize some datetimes and I can't seem to get humanize to work with crispy forms. I have done {% load humanize %} at the top of the template Example from template
0
votes
0 answers

How to evaluate a Humanized Music Shuffling Algorithm?

Suppose, we have a list of songs, let's say 100 songs, and we need to shuffle them such that we can get the ordering of songs (playlist) that looks random to humans. Motivation Example :-…
Umang Jain
  • 21
  • 5
0
votes
1 answer

Round last value in humanize-duration formatted value (React)

I am setting up a table in React that applies humanize-duration to a value (the library applies ms and my data is in s, hence the multplier). {humanizeDuration(time_inventoried*1000, { units: ['y', 'mo', 'w', 'd'] }) } The value I'm…
Boucherie
  • 541
  • 3
  • 16
0
votes
1 answer

Django naturaltime tag

I want to receive time difference,so I have added 'django.contrib.humanize' to Installed Apps, and '{% load humanize %}' to my template, and use it in as below: {% for notification in request.session.notifications %}
  • Natiq Vahabov
    • 497
    • 4
    • 11
  • 0
    votes
    1 answer

    How can I use elasticsearch to search with special commands in query?

    I have an elastic index with many documents. A document represents some event. Every event has a date and geolocation. I would like to send queries like these: "Some event in LA", "Some event tomorrow", "Some event near me"... How could I build this…