Skip to content

Instantly share code, notes, and snippets.

@alejandrobernardis
Created September 14, 2012 06:32
Show Gist options
  • Select an option

  • Save alejandrobernardis/3720204 to your computer and use it in GitHub Desktop.

Select an option

Save alejandrobernardis/3720204 to your computer and use it in GitHub Desktop.
Data Base, User Demo
from settings import DATABASE_USERS
from com.ak.common.security import token
from mongoengine import connect as mongo_connect
settings = dict(host='127.0.0.1', port=27017)
mongo_connect(DATABASE_USERS, **settings)
User.drop_collection()
u = User()
u.username = 'alejandro.bernardis'
u.password = 'alejandro.bernardis'
u.email = 'alejandro.bernardis@gmail.com'
u.token = token(32, include_date=False)
u.facebook_uid = 'fake_'+u.username
u.twitter_uid = 'fake_'+u.username
u.save()
print u.to_object()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment