Skip to content

Instantly share code, notes, and snippets.

@omarish
Created February 17, 2018 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omarish/abd07456ffb78bf2d5b4253400277be0 to your computer and use it in GitHub Desktop.
Save omarish/abd07456ffb78bf2d5b4253400277be0 to your computer and use it in GitHub Desktop.
import mutations
class UserSignup(mutations.Mutation):
name = mutations.fields.CharField()
email = mutations.fields.CharField()
def execute(self):
user = User.objects.create([...])
if user.is_referred_through_partner:
[...]
else:
self.send_welcome_notification()
def send_welcome_notification(self):
if user.is_twitter_signup:
self.send_message(through='twitter')
else:
self.send_message(through='email')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment