0:00 AM
opnchaudhary_ has quit
0:01 AM
eVRiAL has quit
0:03 AM
Hairy joined the channel
0:05 AM
hillaj has quit
0:05 AM
codeme has quit
0:11 AM
codeme joined the channel
0:11 AM
mekhami
does anyone have a more advanced book or resource on testing in django apps than the TDD with Python book?
0:11 AM
Basically I wanna do TDD but every time I go through TDD with Python... I end up learning how to TDD a lists app
0:13 AM
kunalg has quit
0:14 AM
DLSteve has quit
0:16 AM
kunalg joined the channel
0:18 AM
amites has quit
0:20 AM
what function does resolver return from a class based view? i'm writing a test for my url resolver...
0:20 AM
so i do something like foo = resolve('/'), assertEqual(foo.func, IndexView.as_view()) or something
0:21 AM
FunkyBob
mekhami: class based views still use a function... it's what as_view() returns
0:22 AM
as_view is a view function factory
0:22 AM
mekhami
hm
0:22 AM
when i do that assert, it fails
0:22 AM
FunkyBob
ALL VIEWS ARE FUNCTIONS :)
0:22 AM
it won't be equal, because as_view() will return a new view function on each call
0:23 AM
mekhami
hm
0:23 AM
is there any way to write a test for this with CBVs then?
0:23 AM
maybe resolve isn't exactly what i want?
0:23 AM
yassine has quit
0:24 AM
kanja
The django-cms site we've been working on for several months is live
0:24 AM
0:24 AM
we're going to be making it open source soon
0:24 AM
rpkilby has quit
0:24 AM
mekhami
the text on those images
0:24 AM
not good
0:24 AM
kanja
yeah
0:24 AM
limbera
why can't you use named URLs in test cases
0:24 AM
seems a bit silly
0:24 AM
amites joined the channel
0:25 AM
kanja
tried to get the client to do solid colors
0:25 AM
we're going to darken the image to get the white to show up more
0:25 AM
FunkyBob
limbera: what makes you think you can't?
0:25 AM
mekhami
kanja, just tell them to do something sensible like drop it to the bottom and do a blur shadow
0:25 AM
limbera
the docs don't
0:25 AM
so i suppose you can
0:25 AM
i should user reverse shouldn't i
0:28 AM
Ohmnivore joined the channel
0:28 AM
kavefish
I'm stumped and would really appreciate suggestions. I think I need some help with terminology. My goal is to create a custom list_filter for contrib.admin that compares mutliple attributes of the model to return the desired subset.
0:29 AM
mindcruzer joined the channel
0:30 AM
underthehill joined the channel
0:30 AM
hillaj joined the channel
0:30 AM
Have I described something like: add function to list_filter that returns a custom query set?
0:31 AM
autrilla_ joined the channel
0:31 AM
I'm not really sure what part of the docs to go searching in
0:32 AM
limbera
can't work this test out
0:32 AM
0:32 AM
kunalg has quit
0:32 AM
0:32 AM
NomadJim has quit
0:32 AM
i'm starting very basic and just trying to write a test that ping's the view
0:34 AM
autrilla has quit
0:35 AM
FunkyBob
kavefish: last I checked admin filters can only work on a single input value...
0:35 AM
limbera
this is the url: url(r'^signup/$', views.player_create, name='player-create'),
0:35 AM
ASUChander joined the channel
0:35 AM
FunkyBob
kavefish: also, it's sounding like you're trying to use admin for the wrong purpose
0:36 AM
kelseygi_ joined the channel
0:36 AM
kavefish
thanks FunkyBob - I think what I want is a custom SimpleListFilter
0:36 AM
FunkyBob
limbera: is it included in a namespace?
0:36 AM
kavefish
but I'd be glad to for suggestions on a better approach
0:36 AM
NomadJim joined the channel
0:36 AM
could you clarify what you mean?
0:36 AM
limbera
yeah it is
0:36 AM
"teams" namespace
0:37 AM
FunkyBob
kavefish: mean in what regard?
0:37 AM
hydraidm801 joined the channel
0:37 AM
kunalg joined the channel
0:37 AM
limbera
url(r'^teams/', include('apps.teams.urls', namespace='teams')),
0:37 AM
FunkyBob
limbera: sl you use reverse('teams:player-create') ?
0:37 AM
kavefish
FunkyBob: about using the admin incorrectly
0:37 AM
limbera
that is what i have done
0:38 AM
mekhami
Anyone have some advice on testing CBVs? I can't seem to find the right way to do it
0:38 AM
FunkyBob
kavefish: well, it sounds like you're trying to use admin as a management interface for your web site
0:38 AM
hjf_
0:38 AM
FunkyBob
kavefish: where it's currently meant to be a DB Admin interface
0:38 AM
hjf_
send_mail(subj,body,from,to,html_message='etc') ?
0:38 AM
limbera
yes hjf_
0:39 AM
kavefish
I think that's fair. Is the preferred method for site management to create a custom admin interface?
0:39 AM
FunkyBob
kavefish: a custom interface, yes...
0:39 AM
kunalg has quit
0:40 AM
kavefish
not arguing, but what makes you say django.contrib.admin is meant to exclusively for DB admin?
0:41 AM
it's not like you can change the schema from there
0:41 AM
mekhami
0:41 AM
hjf_
hm
0:41 AM
it doesn't seem to work
0:41 AM
mekhami
this is what i've got so far but don't quite understand what's going on
0:41 AM
hjf_
it still sends the plaintext only
0:41 AM
Content-Type: text/plain;
0:41 AM
hydraidm801
I have a contact form that upon submission is redirecting to the wrong url and I don't undertand why
0:41 AM
limbera
kavefish: the interface is very much about tables and data
0:41 AM
hydraidm801
0:41 AM
0:41 AM
FunkyBob
because over the last 10 years I've seen people keep trying to use it, stretch it, twist it... and continue to discover it's really not quite flexible enough, and not worth the effort
0:41 AM
limbera
it's not "logical" from an end set perspective
0:41 AM
djm- joined the channel
0:41 AM
in a database you use foreign keys
0:41 AM
FunkyBob
it seems perfect in the beginning...
0:42 AM
limbera
but in life you use lists
0:42 AM
mindcruzer
trying to customize the Django admin is an exercise in frustration
0:42 AM
kavefish
0:42 AM
mindcruzer
and completely not worth your time
0:42 AM
hydraidm801
0:42 AM
FunkyBob
then you discover it's too data-centric, where your site really needs something more process-centriic that will enforce your business rules
0:42 AM
admin lets you manage and manipulate your data...
0:42 AM
kavefish
interesting
0:43 AM
I'm definitely a beginner
0:43 AM
yuciyuar has quit
0:43 AM
FunkyBob
I have, however, got someone to start working on my plans to split admin into a "console framework" and "admin built on that framework"
0:43 AM
mindcruzer
building a custom management interface with CBVs is trivial
0:43 AM
Hairy joined the channel
0:43 AM
and allows you to add custom stuff much easier
0:44 AM
schneider has quit
0:44 AM
FunkyBob
given the point of django is to make developing web apps simpler...
0:44 AM
SmileyChris
hydraidm801: sure looks like you're returning a redirect to '/thanks/' (which you shouldn't be hardcoding, but anyway...)
0:44 AM
mindcruzer
I have shipped sites with just the django admin, but only really simple sites that took me like a day to make
0:45 AM
for people who have a small budget
0:45 AM
kavefish
thanks for the advice
0:45 AM
hillaj has quit
0:45 AM
hydraidm801
yeah I don't know why
0:45 AM
kavefish
I'm a beginner, so it's hard to differentiate the source of frustration :)
0:46 AM
mekhami
0:47 AM
SmileyChris
mekhami: use the request factory instead of just creating a raw request
0:47 AM
atula joined the channel
0:47 AM
djm- joined the channel
0:47 AM
0:47 AM
kunalg joined the channel
0:48 AM
hydraidm801
only thing I can think is that its on a testing server and the pyc files aren't updated after a reboot
0:48 AM
SmileyChris
hydraidm801: so test on your local machine and compare?
0:48 AM
(not that that is likely)
0:48 AM
hydraidm801
I can't send email from here its pointless
0:49 AM
SmileyChris
so just use the console mail backend
0:49 AM
you're not testing that portion of it anyway
0:49 AM
hydraidm801
well I am trying to test the email portion today
0:49 AM
SmileyChris
that's not what your problem you came here is though
0:49 AM
hydraidm801
yeah somehow the urls are redirecting wrong.
0:50 AM
the debug Request URL should be the one in my form but its not somehow
0:50 AM
kunalg has quit
0:52 AM
limbera
would it be bad practice to do my testing in a "use case" sort of a way
0:53 AM
like create a class called TestSignup(unittest.TestCase)
0:53 AM
that tests getting the signup page
0:53 AM
submitting the form
0:53 AM
checking the databse
0:53 AM
kunalg joined the channel
0:53 AM
SmileyChris
limbera: totally fine to do, you want to keep an eye on coverage though
0:53 AM
limbera
ok cool
0:53 AM
this is my 4th or 5th attempt at writing tests for this app