Permalink
Browse files

Added gen_ipv4() and gen_ipv6() methods

  • Loading branch information...
1 parent 1b40bc9 commit a018939bfb7a6e414b8f4def71d52feb224f4399 @amatellanes amatellanes committed Jan 13, 2014
Showing with 8 additions and 0 deletions.
  1. +8 −0 model_mommy/generators.py
@@ -115,6 +115,14 @@ def gen_url():
def gen_email():
return u"%s@example.com" % gen_string(10)
+
+def gen_ipv6():
+ return ":".join(format(randint(1, 65535), 'x') for i in range(8))
+
+
+def gen_ipv4():
+ return ".".join(str(randint(1, 255)) for i in range(4))
+
def gen_content_type():
return ContentType.objects.get_for_model(choice(get_models()))

0 comments on commit a018939

Please sign in to comment.