|
[20:24:47] |
pilgrimish: |
leaves |
[20:26:28] |
pilgrimish: |
joins |
[21:25:14] |
pilgrimish: |
leaves |
[00:39:37] |
kenbolton: |
joins |
[01:22:19] |
kenbolton: |
leaves |
[01:31:31] |
kenbolton: |
joins |
[02:08:01] |
kenbolton: |
leaves |
[02:21:25] |
pilgrimish: |
joins |
[02:49:02] |
pilgrimish: |
leaves |
[08:32:26] |
thisgeek: |
joins |
[08:39:54] |
thisgeek: |
leaves |
[09:08:24] |
thisgeek: |
joins |
[09:27:28] |
thisgeek: |
leaves |
[09:29:38] |
thisgeek: |
joins |
[09:53:24] |
pilgrimish: |
joins |
[10:05:41] |
kenbolton: |
joins |
[10:39:03] |
thisgeek: |
leaves |
[10:58:04] |
thisgeek: |
joins |
[11:20:27] |
oxbits: |
joins |
[11:20:32] |
kenbolton: |
oxbits: yo yo yo! |
[11:20:39] |
oxbits: |
yo! |
[11:20:49] |
kenbolton: |
what's the rumpus? |
[11:21:27] |
oxbits: |
the rumpus is I checked out back to an old state, and I cannot figure out how to get back to the current state |
[11:21:31] |
oxbits: |
in git |
[11:22:04] |
oxbits: |
when I git log, I only see old stuff |
[11:22:38] |
oxbits: |
so I cannot checkout to the current hash |
[11:22:47] |
oxbits: |
because I do not know what it is |
[11:24:16] |
oxbits: |
ok, so when I go to github I see the hash of the latest commit |
[11:24:28] |
oxbits: |
I will try to check that out |
[11:24:40] |
kenbolton: |
yeah, that should do ya |
[11:25:11] |
kenbolton: |
oxbits: that is a case where a visual git client might be more helpful. |
[11:25:20] |
oxbits: |
but how do you list all hashes in log when you are in an old state |
[11:25:25] |
oxbits: |
? |
[11:25:32] |
kenbolton: |
http://rowanj.github.io/gitx/ |
[11:26:33] |
kenbolton: |
oxbits: git log --all |
[11:26:37] |
oxbits: |
so I can use it locally to look around, but remember I am on a remote dev environment |
[11:26:45] |
kenbolton: |
ugh |
[11:26:55] |
kenbolton: |
"remote dev environment" is code for broken. |
[11:27:03] |
kenbolton: |
broken process |
[11:27:17] |
oxbits: |
ugh |
[11:27:21] |
oxbits: |
for sure |
[11:28:16] |
kenbolton: |
i keep talking to people on #mezzanine who are complaining that their web application doesn't work, come to discover they have never run the application locally. |
[11:29:09] |
kenbolton: |
they end up blaming the framework, but they ignored the explicit steps used to get the framework running locally. |
[11:29:36] |
kenbolton: |
i'm all in favor of pushing to production early. |
[11:29:40] |
kenbolton: |
and often! |
[11:29:51] |
kenbolton: |
github does rolling releases, after all. |
[11:30:16] |
kenbolton: |
oxbits: git log --all help? |
[11:30:28] |
oxbits: |
big time, yes, thank you! |
[11:30:29] |
kenbolton: |
that is, did `git log --all` help? |
[11:30:32] |
kenbolton: |
awesome. |
[11:30:41] |
kenbolton: |
fwiw, i googled "git show future commits" |
[11:31:19] |
kenbolton: |
good git write-up: http://www-cs-students.stanford.edu/~blynn/gitmagic/ch01.html |
[11:31:49] |
kenbolton: |
http://www-cs-students.stanford.edu/~blynn/gitmagic/ch04.html#_uninterrupted_workflow |
[11:39:02] |
oxbits: |
I will follow up |
[11:39:04] |
oxbits: |
thanks |
[11:39:19] |
oxbits: |
who else is in here? |
[11:39:51] |
kenbolton: |
dan, walter, chris, you, a bot, and me. |
[11:39:53] |
oxbits: |
Howdy y'all! This is Alex, just in case. |
[11:40:13] |
kenbolton: |
digignotty is the bot that logs the chats. |
[11:40:27] |
oxbits: |
Hi digignotty! |
[11:40:40] |
kenbolton: |
hardest working bot in botbiz. |
[12:17:23] |
pilgrimish: |
hey @oxbits |
[12:17:29] |
pilgrimish: |
that he is |
[12:18:27] |
oxbits: |
howdy @pilgrimish |
[12:18:35] |
pilgrimish: |
welcome! |
[12:18:47] |
kenbolton: |
alex, dan, welcome! |
[12:41:55] |
oxbits: |
other coder just called my code an eyesore |
[12:43:59] |
oxbits: |
because I used locale.format instead of his suggestion: "%s" |
[12:44:26] |
oxbits: |
for commas in numbers |
[12:48:17] |
pilgrimish: |
leaves |
[12:56:06] |
kenbolton: |
oxbits: you talking about string substitution? |
[12:56:20] |
kenbolton: |
don't sweat it. it takes practice, but you'll get it to be idiomatic. |
[12:56:32] |
kenbolton: |
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html |
[12:56:43] |
oxbits: |
I am talking' large numbers separated by commas |
[12:57:16] |
oxbits: |
thousands, millions, billions |
[12:57:27] |
kenbolton: |
wait, does he want you to break the string of digits into smaller groups and slip in commas? |
[12:57:39] |
kenbolton: |
e.g.: |
[12:57:59] |
kenbolton: |
'%s,%s,%s' % (10, 200, 420) |
[12:58:12] |
kenbolton: |
like: |
[12:58:17] |
kenbolton: |
tens = 420 |
[12:58:21] |
kenbolton: |
hundreds = 200 |
[12:58:25] |
kenbolton: |
thousands = 10 |
[12:58:28] |
oxbits: |
not sure what he means |
[12:58:42] |
kenbolton: |
'%s,%s,%s' % (thousands, hundreds, tens) |
[12:58:47] |
kenbolton: |
because that would be silly. |
[12:59:09] |
kenbolton: |
tell him his language is not constructive. |
[12:59:32] |
oxbits: |
I tried to stick: format(a, ",d") into admin.py but it resulted in blank cells |
[13:00:12] |
oxbits: |
so I used the locale.format way, and it worked, so I was happy, until it was an eyesore |
[13:00:41] |
kenbolton: |
https://docs.djangoproject.com/en/dev/topics/i18n/formatting/#creating-custom-format-files |
[13:01:18] |
kenbolton: |
shouldn't mess with the admin that way. |
[13:01:25] |
kenbolton: |
i mean, it is doable, but brittle. |
[13:01:51] |
oxbits: |
I did this: |
[13:01:52] |
oxbits: |
http://stackoverflow.com/questions/1823058/how-to-print-number-with-commas-as-thousands-separators-in-python-2-x |
[13:02:59] |
kenbolton: |
logic like that should be kept out of the admin interface, imo. |
[13:04:03] |
kenbolton: |
can you post the other dev's solution? |
[13:14:40] |
waltd3: |
leaves |
[13:17:36] |
oxbits: |
he has not offered it yet, I will let you know |
[13:17:56] |
kenbolton: |
well that is certainly less than helpful as a code review. |
[13:18:46] |
oxbits: |
where should it take place? |
[13:20:37] |
kenbolton: |
oxbits: hm? i mean that suggesting that someone else's code isn't up to snuff without providing a clear idea of what the problem is is less than helpful. |
[13:21:05] |
oxbits: |
no I mean, where other than admin |
[13:21:15] |
oxbits: |
wait, brb |
[13:23:17] |
kenbolton: |
oxbits: you just want to change the display of the data, right? not the data itself? so that seems like it should happen in the templates, not in the business logic. if it needs to happen in the biz logic, it should happen in the models.py |
[13:30:42] |
kenbolton: |
http://effectivedjango.com/#everything-in-its-right-place, at the bottom of the page. |
[13:30:54] |
kenbolton: |
Views Convert Request to Response |
[13:30:55] |
kenbolton: |
Forms Convert input to Python objects |
[13:30:56] |
kenbolton: |
Models Data and business logic |
[13:32:06] |
kenbolton: |
and Admin, which is not listed, marshalls the fields for the admin interface. |
[13:32:49] |
kenbolton: |
the reason admin is not listed is that it really just controls which fields or widgets get used for each model. |
[13:33:37] |
kenbolton: |
and only for Admin users! |
[14:16:34] |
oxbits: |
you are correct! |
[14:16:57] |
kenbolton: |
nice |
[14:17:51] |
oxbits: |
but how do I target a single column in a default template |
[14:17:53] |
oxbits: |
? |
[14:18:15] |
kenbolton: |
so you want to display this data, right? |
[14:18:29] |
oxbits: |
yes |
[14:18:47] |
kenbolton: |
lets say you have a model Article |
[14:19:16] |
kenbolton: |
and Article has a field, uh, reader_count. |
[14:19:33] |
kenbolton: |
and a field title. |
[14:19:54] |
oxbits: |
yes |
[14:19:58] |
kenbolton: |
article = Article.objects.get(title='Great New Article') |
[14:20:14] |
oxbits: |
right |
[14:20:15] |
kenbolton: |
and that gets passed into the template context as 'article'. |
[14:20:44] |
kenbolton: |
in the template, {{ article }} will return the __unicode__() |
[14:20:57] |
kenbolton: |
rather article.__unicode__() |
[14:21:12] |
kenbolton: |
{{ article.title }} will display the title. |
[14:21:23] |
kenbolton: |
and {{ article.read_count }} would display the number of readers. |
[14:22:11] |
kenbolton: |
you can lost the humanize templatetags {% load humanize %} (https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#ref-contrib-humanize) |
[14:23:13] |
kenbolton: |
and do {{ article.reader_count|incomma }} to convert the integer stored in reader_count and convert it into a "humanized" version. |
[14:23:20] |
kenbolton: |
https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#intcomma |
[14:23:34] |
oxbits: |
intcomma |
[14:23:42] |
kenbolton: |
you got it. |
[14:23:50] |
oxbits: |
but wait |
[14:24:08] |
kenbolton: |
that will look at your locale and deliver the appropriately formatted integer. |
[14:27:23] |
oxbits: |
I did this to get columns to be right formatted: |
[14:27:25] |
oxbits: |
https://gist.github.com/oxbits/5504214 |
[14:28:31] |
kenbolton: |
ok, switched gears. |
[14:28:46] |
oxbits: |
how would I extend admin/change_list.html for just those values |
[14:28:47] |
oxbits: |
? |
[14:29:05] |
oxbits: |
with intcomma |
[14:29:13] |
kenbolton: |
why does the admin even get this? |
[14:29:23] |
kenbolton: |
seems like a feature in search of a need. |
[14:29:58] |
oxbits: |
well what I am saying is that I thought change_list.html was a default template |
[14:30:13] |
kenbolton: |
it is |
[14:31:05] |
kenbolton: |
my confusion is around why this is happening at the admin level. |
[14:31:06] |
oxbits: |
should I just extend it, and then figure out which part to override to get what I want? |
[14:31:29] |
oxbits: |
It should not be at the admin level like you said |
[14:32:15] |
oxbits: |
I just knew I could alter what was being displayed in the admin.py, without having to create a new template |
[14:32:31] |
kenbolton: |
you have a url pattern connected to a view. |
[14:32:40] |
kenbolton: |
make the template. |
[14:32:53] |
kenbolton: |
that template can be four or five lines long. |
[14:33:00] |
oxbits: |
I just don't understand the entire admin template system |
[14:33:11] |
kenbolton: |
step away from it. |
[14:33:44] |
kenbolton: |
it isn't complicated, but it will help to get a firm grasp of the templates outside of the admin. |
[14:33:45] |
oxbits: |
I am working on how things are displayed in the admin pages |
[14:34:01] |
kenbolton: |
are you using django-debug-toolbar? |
[14:34:20] |
oxbits: |
I do not know, but I will check |
[14:34:30] |
kenbolton: |
that will help you see which templates are actually getting called, as well as the view that is calling the template. |
[14:35:42] |
kenbolton: |
fwiw: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#custom-template-options |
[14:36:05] |
kenbolton: |
that is how, in the admin, you override which template a model will use. |
[14:36:39] |
oxbits: |
cool |
[14:45:04] |
waltd3: |
joins |
[15:02:12] |
kenbolton: |
leaves |
[15:54:57] |
pilgrimish: |
joins |
[18:33:41] |
pilgrimish: |
leaves |
[19:09:22] |
pilgrimish: |
joins |
[19:15:46] |
oxbits: |
leaves |
[19:38:42] |
oxbits: |
joins |
[19:52:36] |
oxbits_: |
joins |
[19:53:16] |
oxbits: |
leaves |
[19:53:16] |
oxbits_: |
is now known as oxbits |
[19:58:10] |
pilgrimish: |
leaves |