These are chat archives for django/django

3rd
Aug 2016
mark
@thenewidealism_twitter
Aug 03 2016 06:37
how do i change the time to be displayed like ‘….. minutes ago’? here? {{post.publish}}
MinJae Kwon
@mingrammer
Aug 03 2016 07:01
make filter that translate the datetime to pretty format (like a ... ago)
by calculating the (current timestamp) - (post.publish)
mark
@thenewidealism_twitter
Aug 03 2016 07:14
um
where should i do that though? i have publish all over the place. models, forms and views.
wait..
yeah. is it the views.py?
MinJae Kwon
@mingrammer
Aug 03 2016 07:21
Don't make that on models, views. You can make custom template filter
Make the template filter and just use that on template files
mark
@thenewidealism_twitter
Aug 03 2016 07:22
im afraid im using dajngo rest framework.
MinJae Kwon
@mingrammer
Aug 03 2016 07:22
Ah
mark
@thenewidealism_twitter
Aug 03 2016 07:23
반갑습니다.
MinJae Kwon
@mingrammer
Aug 03 2016 07:24
Are you korean?
mark
@thenewidealism_twitter
Aug 03 2016 07:24
yes
MinJae Kwon
@mingrammer
Aug 03 2016 07:24
안녕하세요
mark
@thenewidealism_twitter
Aug 03 2016 07:24
pm 드릴게요
Mohammed Hussein
@mamehussen
Aug 03 2016 10:15
@Oclay2_twitter I got some problems on the django-rest-framework if u use that
got some trouble with csrf token authentication
Anders Eriksen
@anderser
Aug 03 2016 11:10
Hi. I’ve got problems with django run server takes a long time to load/run. Profiling shows that posix.waitpid probably is the one to blame. But how do I fix it? Seems others have had same problem, but no good solution out there.
Running 1.7.1 btw
cossio
@cossio
Aug 03 2016 13:09
hi all
Oleg Serbokryl
@Krokop
Aug 03 2016 15:04
hi
cossio
@cossio
Aug 03 2016 15:04
I'm hoping someone can help me with exporting django data to excel
Oleg Serbokryl
@Krokop
Aug 03 2016 15:05
@cossio what data you want export? from model?
cossio
@cossio
Aug 03 2016 15:05
yes, from Model
I'm trying django-import-export right now
but I want to customize the print format of some fields in the excel file
Nnamdi
@nnamdiib
Aug 03 2016 15:12
Can someone please link me to their Django project on github or something?
I am trying to learn more by reading other people's code
Thank you!
cossio
@cossio
Aug 03 2016 15:34
@Krokop I'm following the instructions there
but I got an error, trying to export xlsx
I don't understand the code 100%, so I'm having a hard time figuring out what's going on
Here's the error:
TypeError
init() got an unexpected keywod argument 'mimetype'
Oclay
@Oclay2_twitter
Aug 03 2016 17:34
@mamehussen csrf token isn't a problem for me
calebwhites
@calebwhites
Aug 03 2016 19:39
I'm wondering why my icon isn't showing up when a user selects the radio field and presses submit. Maybe the html code will help make things less confusing.
<form action="{% url 'registry:purchased' registry.id %}" method="post">
    {% csrf_token %}
    {% for item in registry.item_set.all %}
        <input type="radio" id="item{{ forloop.counter }}" name="item" value="{{ item.id }}" />
        <label for="item{{ forloop.counter }}">
            {{ item.item_title }}
            {% if item.is_purchased %}
                <img src="https://upload.wikimedia.org/wikipedia/commons/1/10/Map_marker_icon_–_Nicolas_Mollet_–_Supermarket_–_Stores_–_dark.png" />
            {% endif %}
        </label><br>
    {% endfor %}
    <input type="submit" value="Purchased">
</form>
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 19:43
@calebwhites thats a VueJS issue it seems
calebwhites
@calebwhites
Aug 03 2016 19:44
@poppabear8883 How so?
Mauro Oviedo
@moviedo
Aug 03 2016 19:45
@poppabear8883 I use vuejs with django via brunch
why do you ask?
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 19:45
i'm just saying that @calebwhites issue isn't specific to django, its very specific to vuejs
calebwhites
@calebwhites
Aug 03 2016 19:46
I've never heard of VueJS before.
Mauro Oviedo
@moviedo
Aug 03 2016 19:46
it's like React, without JSX
it's very good, has a great gitter room
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 19:46
oh my bad @calebwhites
i seen the
for="item{{ forloop.counter }}">
and thought that was a vuejs for loop directive :package:
:)
calebwhites
@calebwhites
Aug 03 2016 19:47
@moviedo That's actually really interesting. I'll have to look into it.
@poppabear8883 Oh I gotcha! No, what I'm having an issue with is the icon doesn't show when I press submit. So https://upload.wikimedia.org/wikipedia/commons/1/10/Map_marker_icon_–_Nicolas_Mollet_–_Supermarket_–_Stores_–_dark.png is the icon, and I need it to appear when the user selects an item and presses submit.
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 19:51
does the page refresh on submit ? or isn't it calling ajax ?
it looks like its calling a static action
calebwhites
@calebwhites
Aug 03 2016 19:52
It does. It goes to /purchased/
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 19:52
i would be checking to make sure the item is indeed being updated
specifically item.is_purchased value
calebwhites
@calebwhites
Aug 03 2016 19:53
So when the user submits, it opens it in a different url. In this case ..../purchased/
So, yes, it is being updated. It's just the icon doesn't show.
It sends a "You did not select a valid item" if there is an error.
Would it be of help if I send you the snippet for the views.py?
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 20:01
i mean i don't see any issues with your code, if item.is_purchased is set to anything other then null, NoneType or false then it should work ...
simple conditional rendering
calebwhites
@calebwhites
Aug 03 2016 20:03
There isn't anything wrong, you're correct. It all updates in the database. The issue is that it doesn't show the icon afterwards like it is supposed. Anyways, I'm thinking about adding bootstrap into the website and possibly using a glyphicon instead might do the trick.
Oclay
@Oclay2_twitter
Aug 03 2016 20:21
@poppabear8883 hey men, how are you? did you finish you project?
calebwhites
@calebwhites
Aug 03 2016 20:21
Also in models.py
is_purchased = models.BooleanField(default=False)
Oclay
@Oclay2_twitter
Aug 03 2016 20:22
@poppabear8883 "your"
Everett (Mike) Wiley
@poppabear8883
Aug 03 2016 20:23
@Oclay2_twitter i won't be done with this project for a good while, its a large scale project and still in early pre-alpha stages .. its made up of components, and each component is like its own project/app .. and those are in early beta stages ... so it has a long way to go for any Beta Releases ...
Oclay
@Oclay2_twitter
Aug 03 2016 20:27
if "is_purchased" is always false then ... @calebwhites
@poppabear8883 oh, nice!!
calebwhites
@calebwhites
Aug 03 2016 20:38
@Oclay2_twitter Could you elaborate a little bit more?
Oclay
@Oclay2_twitter
Aug 03 2016 20:50
well,the field is False by default @calebwhites
calebwhites
@calebwhites
Aug 03 2016 20:58
@Oclay2_twitter Right, until the until the user clicks on the radio button, then it becomes true
Oclay
@Oclay2_twitter
Aug 03 2016 21:33
@calebwhites can you paste your views.py ?
use https://dpaste.de, please