Friday, October 21, 2016

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

As someone POSTs a questionnaire, I lookup some additional info about the IP and save that into a model's JSONField.
I'm sending the request into django-ipware's get_ip(), which will return the IP address as a string. Since this data is ephemeral, I put it directly in the constructor instead of storing the return value in a variable.
My bad, should've included the imports at the top of the file so you know where get_ip() comes from.

On Friday, 21 October 2016 21:33:42 UTC+2, Alex Heyden wrote:
Are you intentionally sending the whole request into that constructor and concatenating it to a URL string? I can't imagine any way this doesn't end in disaster.

I'm sure the community would happily help, but it's not at all obvious from the supplied code what you're trying to do here.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ad4ef983-3430-4058-ae24-e036cd6205f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment