Example #1
0
def register(request):
	u = User()
	c = PostCount()
	p = Profile()
	if request.method == "POST":
		u.username = request.POST.get('user')
		u.set_password(request.POST.get('pass'))
		u.email = request.POST.get('email')
		u.is_active = True
		u.is_staff = False
		u.is_superuser = False
		u.save()
		c.user = u
		c.count = 0
		c.save()
		p.member = u
		p.save()
		return HttpResponseRedirect('/login/')
	return render(request, 'auth/register.html')
Example #2
0
	def handle(self, *args, **options):
		for u in User.objects.all():
			x = PostCount()
			x.user = u
			x.count = int(Topic.objects.filter(author=u).count()) + int(Post.objects.filter(author=u).count())
			x.save()