#django

/

      • ejb
        ok
      • dlam joined the channel
      • luanp has quit
      • a swift punch to the throat
      • tbaxter
        ejb: get_success_url() takes self, and from there you should have self.form_class or self.get_form_class()
      • atula
        epicowl: perhaps you should check when you .save() to see if object is even saved.
      • kezabelle
        tbaxter: yeah, but not the constructed form instance
      • hexsprite_ joined the channel
      • ejb
        are form values in cleaned_fields
      • tbaxter
        or self.get_form()
      • kezabelle
        ie, to get the cleaned data, you'd have to construct it again (or just pull it out of POST, because hey, it's already been validated ;o)
      • atula
        epicowl: I actually like to do an assertion to see if objects are saved first before doing anything else.
      • epicowl: if it's not saved, then try creating it using the django shell
      • mrap joined the channel
      • epicowl
        atula: yeah I think it can't save because the table doesn't exist
      • atula
        epicowl: do you use south for migration scripts?
      • epicowl
        yes
      • atula
        epicowl: perhaps you're missing a migration script somewhere.
      • dray3 has quit
      • try doing python manage.py migrate --list
      • or do a schemamigration --auto
      • must be missing something there
      • … by the way, are you recreating the… universe?
      • you're missing an app calls "bang"
      • or "god" depends on your belief
      • epicowl
        atula: the thing is that I have this models.py (used for test only) inside app/content/tests/models
      • lightstrike has quit
      • lol
      • JustSighDudes has quit
      • rickeyski-k joined the channel
      • thats the structure
      • er
      • tests/__init__.py, tests/test_forms.py, tests/models.py
      • test_forms.py imports the TestRelation model from the models.py to use in the test (I do this because I needed to make a mock model to use in this case)
      • Siecje
        epicowl: why do you have models used for testing only?
      • atula
        epicowl: oh that is odd. I have never needed to have models in tests
      • epicowl
        Siecje: because the model used in the project is in another project that is layered on top of the project Im working in
      • atula
        ah I see.
      • epicowl
        and the base model in the project I'm working in is an abstract model
      • Sharebear joined the channel
      • atula
        oh boy. that is tough
      • paul_trone has quit
      • foghsho has quit
      • you may need to do "migration" manually?
      • sohail has quit
      • d0c0nnor has quit
      • kezabelle
        tbaxter: fwiw, here's what I have ended up with (ugh) for tracking the previous iterations: https://gist.github.com/kezabelle/0ea43ad2185ca...
      • unfortunately, my HTML is still coming out wrecked, so this'll be fun to try and figure out :D
      • ryannielson has quit
      • preds joined the channel
      • sohail joined the channel
      • dray3 joined the channel
      • tbaxter
        kezabelle: I'm seeing closing LIs, but no opening?
      • kezabelle
        yeah, that is happening outside the scope of that snippet
      • the tag seems to work correctly, assuming I can jiggle the HTML into the correct order ;)
      • Kobrakao has quit
      • quake_guy has quit
      • all this just to avoid recursion :|
      • tbaxter
        That's what I'm saying… you're closing LIs, but not opening them. Browser is probably guessing that you want to open, but missing one.
      • Sharebear has quit
      • batisteo has quit
      • Course I haven't seen the output, so that's WAG
      • kezabelle
        oh yeah, I'm well aware that it won't work with the output you see there, but the template it's in needs refactoring, and would only have muddied the situation :)
      • bwillielv has quit
      • mrap has quit
      • asparagui joined the channel
      • margle joined the channel
      • margle has quit
      • margle joined the channel
      • m8 has quit
      • Raisins joined the channel
      • rabbite joined the channel
      • tsurantino
        hey guys so I subclassed AbstractUser to add 2 fields - but now when I sync Django doesn't ask me to make an admin user or anything
      • do I have to redefine these methods? I thought AbstractUser would handle it
      • asparagui has left the channel
      • jwa
        tsurantino: it won't prompt you for creation if you don't use the default model, just call create(super)user yourself
      • rabbite
        I'm really new to django, coming from ruby on rails. I've inherited a fairly large project, and I'm trying to write test for it. I have request = self.factory.get('/rbd/schedule/')
      • Then self.assertEqual(request.status_code, 200)
      • which keeps failing because the response is returning a 302
      • andrey_ has quit
      • is it normal in django for every url to be a redirect?
      • kezabelle
        of course not
      • tsurantino
        jwa: can you be more specific?
      • rabbite
        It doesnt appear that way in the server logs when I do it manually in local.
      • kezabelle
        does it require authentication or something?
      • jwa
        tsurantino: I suppose you have changed AUTH_USER_MODEL? if so just call manage.py createsuperuser
      • rabbite
        kezabelle: normally, everything exists behind a login
      • ahh unrelated
      • kezabelle
        rabbite: so why are you surprised you get redirected to the login? :)
      • rabbite
        I've found that response = self.client.get('/rbd/settings/', follow=True)
      • returns 200 though.
      • zenethian
        ls
      • bah
      • kezabelle
        wrong window ;)
      • rabbite
        Think it might be because it's bouncing me to the login?
      • zenethian
        Indeed, hah.
      • kezabelle
        rabbite: unless your test client is logged in, yes
      • margle has quit
      • melinath has quit
      • (and the login is a 200, which is why following the redirect will get the 'correct' status_code, even though it's wrong)
      • rabbite
        Any resources where I can read up about writing test for systems behind a login?
      • I see, I suspected as much, but wasn't sure if it was a Django thing.
      • __love__
        rabbite: just log the test client in. self.client.login(username, password), iirc
      • tbaxter
        as I recall, factory doesn't authenticate (or have request, by default), which makes TestClient considerably easier to use.
      • melinath joined the channel
      • sudobangbang has quit
      • sohail has quit
      • tsurantino
        jwa: so I have a foreign key that (apparently) can't be null. is there any way I can modify createsuperuser to give it some arbitrary value?
      • Sharebear joined the channel
      • nicklo joined the channel
      • jwa
        tsurantino: createsuperuser doesn't support fkeys, no
      • tsurantino
        ok cool, thanks
      • rabbite
        __love__: Would I need to do that in every test? Or can I handle that in the setup?
      • jwa
        rabbite: setUp() is for that, yes
      • Kingino joined the channel
      • Kingino has quit
      • Kingino joined the channel
      • rabbite
        Hm, thanks. I'll give those suggestions a try. Yet another reason I <3 freenode
      • epicowl
        atula: got it working… had to import the model in my __init__ file
      • jwa
        rabbite: well not every channel's as friendly as #django ;)
      • atula
        epicowl: ah I see. good to know then!
      • epicowl
        def
      • kanja has quit
      • tbaxter
        I believe setupclass is even better.
      • jwa
        tbaxter: for login?
      • tbaxter
        I think so
      • mattmcc
        tsurantino: You can override management commands, sure.
      • rabbite
        jwa: I'm a real newb to django, but it seems there is a rather large, supportive community around it
      • tbaxter
        we try
      • mattmcc
        Just put an app in front of auth that defines a createsuperuser command.
      • sohail joined the channel
      • setmeaway has quit
      • mplang has quit
      • japandroid joined the channel
      • japandroid has quit
      • kanja joined the channel
      • lduros has quit
      • hexsprite_ has quit
      • hexsprite has quit
      • adamsilver joined the channel
      • passy joined the channel
      • mezner joined the channel
      • japandroid joined the channel
      • japandroid has quit
      • lduros joined the channel
      • raijin has quit
      • japandroid joined the channel