Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Australian Business Numbers #63

Merged
merged 1 commit into from
May 6, 2016

Conversation

danni
Copy link

@danni danni commented Dec 9, 2013

No description provided.

invalid = {
'53004085617': error_format,
}
self.assertFieldOutput(AUBusinessNumberField, valid, invalid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are missing for the AUBusinessNumberField model field.

@danni
Copy link
Author

danni commented Jan 13, 2014

Added a few more tests. There are generally no tests for the models themselves except via the modelform.

class AUBusinessNumberField(CharField):
"""
A form field that validates input as an Australian Business Number (ABN)
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add .. versionadded:: 1.1 here?

@mxsasha
Copy link
Member

mxsasha commented Mar 11, 2014

@danni are you still interested in this patch? The tests failed for the last update of your pull request.

@danni
Copy link
Author

danni commented Mar 11, 2014

Definitely still interested. Hadn't realised Travis had failed. Wonder why it suddenly started failing on a docstring change... will investigate.

@danni
Copy link
Author

danni commented Mar 11, 2014

Aah, it failed on the merge to master and test. Fix coming.

@danni
Copy link
Author

danni commented Mar 14, 2014

@erikr: ping?

@mxsasha
Copy link
Member

mxsasha commented Mar 15, 2014

There are a lot of one-char meaningless variable names used in the validation, which makes it unnecessarily hard to read.

I'm not sure about the model field tests. The tests definitely cover the model field as well, but there are indeed no specific tests for it. Perhaps @jezdez has a particular opinion on this?

@jezdez
Copy link
Contributor

jezdez commented Jun 3, 2014

Yeah, I think the one character stuff in the validator is unfortunate, @danni do you think you could fix those?

With regard to model testing, I think it would make sense to have one, just to be sure the validation etc is picked up.

@jezdez jezdez modified the milestone: 1.2 Nov 16, 2014
@benkonrath benkonrath removed this from the 1.2 milestone Nov 23, 2015
@jscn
Copy link

jscn commented Mar 8, 2016

I'd like to see this merged. Is it okay to rebase onto master and push to this PR, or should I create a new PR?

@danni
Copy link
Author

danni commented Mar 8, 2016

@jscn go for it

@jscn
Copy link

jscn commented Mar 9, 2016

@jezdez @erikr I think I've addressed both your concerns, care to take a look?

@jscn
Copy link

jscn commented Mar 16, 2016

ping? @erikr @jezdez

@benkonrath
Copy link
Member

erikr and jezdez haven't spent much time on this project recently. I can take over this PR review but I'm a little pressed for time right now. I might able to spend some time next week.

@jscn
Copy link

jscn commented Mar 16, 2016

No worries, thanks for the update.

@benkonrath
Copy link
Member

A quick update: I'm at DjangoCon EU and plan to look at this during the sprints on Saturday and Sunday (if I don't find time before then).

@benkonrath benkonrath self-assigned this Mar 31, 2016
@benkonrath benkonrath added this to the 1.3 milestone Apr 10, 2016
"""
Return a cleaned ABN.
"""
value = super(AUBusinessNumberField, self).clean(value)\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space before the ''.

You don't actually need to put the '.replace(...)' on a separate line because we're using 120 character lines in this project. That said, we're not enforcing a specific style yet so you can keep the shorter lines if that's your preference.

try:
validator(valid_abn)
except ValidationError:
self.fail('Validation unexpectedly failed.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, you don't need the try / except.

@benkonrath
Copy link
Member

@jscn Sorry for the delay in reviewing this. As I mentioned, I wanted to do this during the sprints at DjangoCon EU but there were more people at the sprints that wanted to help out with localflavor than I expected. I've added my comments now and I'm looking forward to your thoughts. Thanks.

@jscn
Copy link

jscn commented Apr 29, 2016

@benkonrath I think I've fixed all the problems you identified, now. I'd really like to get this in for the 1.3 release, so let me know as soon as you can if there are any other changes you'd like to see.

@jscn
Copy link

jscn commented May 3, 2016

:/ apparently isort and I disagree about correct ordering of imports.

@benkonrath
Copy link
Member

@jscn I'm just back online from a short vacation. Thanks for reworking this - it looks good. Just a couple of housekeeping items left:

  • Add an entry to the docs/changelog.rst describing the change.
  • Add an entry for your name and @danni's name to the docs/authors.rst file if it's not already there.
  • Rebase and squash the commits into 1 commit.

I'd like to get this into 1.3 as well - I can delay by a day or two if you need a bit of time to sort this out. Thanks again for your work on this feature.

@jscn
Copy link

jscn commented May 5, 2016

@benkonrath Thanks for your help getting this in shape, I think it's all ready to go now, but let me know if there are further changes needed.

@benkonrath benkonrath merged commit a49a610 into django:master May 6, 2016
@benkonrath
Copy link
Member

Thank you too. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants