Closed whonut closed 8 years ago
@@ master #23 diff @@
===================================
Files 6 8 +2
Lines 89 126 +37
Methods 0 0
Messages 0 0
Branches 0 0
===================================
+ Hits 89 126 +37
Misses 0 0
Partials 0 0
Powered by Codecov. Last updated by f882bd7...72ec194
I'm kind annoyed that those Django api tutorials just suggest to make serialized classes, when this is clearly better!
Just an fyi, one of your tests is failing, but not failing travis. Which also explains why codecov isn't 100%.
Which test? They all pass on my machine...
@whonut I would suggest merging with master since bad tests should fail the travis build now.
Also looks like it can't connect to the website on travis. That'll be fun to debug ;)
You should also add newline at the end of each file to comply to PEP8.
@pejter Sublime Text displays a spurious blank line when you do that apparently! That'll explain why my linter was shouting at me for leaving (what I saw as) 2 blank lines at the end of a file. I've fiddled with my preferences, won't be problem now.
I'm feeling around blind trying to fix that failing test, everything works on my machine. Sorry if I do/did something stupid.
OK that 'fix' was (as I suspected) not one. I'm out of ideas.
@whonut I would recommend making a new branch when it comes to testing travis. That way you can keep this PR clean. You can rebase and merge back here later.
objects.create
only returns the instance of the object. You need to call .save()
on the instance for the change to be applied to the database.
From Django docs: Note that instantiating a model in no way touches your database; for that, you need to save().
Some other points:
@probably-not-a-cat OK, sorry about that. Should I squash that last one?
@pejter create
saves it though...? Docs:
A convenience method for creating an object and saving it all in one step. Thus:
p = Person.objects.create(first_name="Bruce", last_name="Springsteen")
and:
p = Person(first_name="Bruce", last_name="Springsteen") p.save(force_insert=True)
are equivalent.
Thanks for the help with the tests. I think I've done it right now but I'll wait to hear back before pushing.
I can only apologise for my ineptitude with this. Thank you both.
I wouldn't. I tried squashing a PR before and github doesn't handle it nicely. It's not a big deal to leave it.
And no worries! Thanks for doing this!
Just an FYI, sometimes travis builds have issues that are not because of your code, which happens to be why it failed here. I would just wait a bit and restart the build.
Just FYI, I've made a class-based version, if that's what we're going with.
This looks good to me. 👍
Since there's no activity on here, and all concerns have been addressed, I would :shipit: (merge).
Well we did settle on using the class-based approach so I was waiting for that. @whonut has to merge that into this branch and we can merge it.
And I was waiting for the go-ahead 😝 Will merge.
I've merged the class-based branch now. It shows up in the commits tab, if not here.
This addresses #19. The URL patterns are probably not what we want but I thought that was something best discussed. Any and all comments and criticisms are welcome.