Re: Possible Basic kwargs question.

2013-04-16 Thread Mario Gudelj
I think this might be a useful article for you
http://agiliq.com/blog/2012/06/understanding-args-and-kwargs/


On 17 April 2013 15:45, Brad Pitcher  wrote:

> I see what you're saying. Maybe you're looking for something more like
> this?
>
> def method1(self, param1=sensible_default, param2=sensible_default,
> param3=sensible_default):
> print param1, param2, param3
>
> The variable names must be specified in the method arguments like above if
> you wish to reference them by name inside the method itself. With this
> method, you will also need to call it with: model.method1(**params)
>
>
> On Tue, Apr 16, 2013 at 9:59 PM, jayhalleaux wrote:
>
>> but if I did that then i would have a variable named kwargs.
>>
>> and it would be print kwargs['param1'], etc
>>
>> Why even unpack the dictionary?  I could just pass the dictionary instead.
>>
>>
>> On Tuesday, April 16, 2013 11:08:42 PM UTC-4, Brad Pitcher wrote:
>>
>>> It should be:
>>> model.method1(**params)
>>> On Apr 16, 2013 7:49 PM, "jayhalleaux"  wrote:
>>>
  Not really a Django question but I'm trying to create a model method
 that does not have a fixed set of parameters.

 models.py
 Class Model_A(model.Model):
 ...

 def method1(self, **kwargs):

 print param1, param2, param3



 views.py
 params = dict(

 param1=something1,
 param2=something2,
  param3=something3,
 ...

 )

 model.method1(params)

 In this example when I try to do something like this it states that I
 should have passed only 1 parameter instead of 2.

 I thought the whole point of using '**' to unpack dictionaries is so
 you don't have to have a fixed number of parameters.

 Is there something I am missing or am I doing this incorrect? First
 time I'm trying to create a method like this.  Normally I explicitly state
 all parameters.

 Any help is appreciated.

 --
 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...@**googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.

 Visit this group at 
 http://groups.google.com/**group/django-users?hl=en
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .



>>>  --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Possible Basic kwargs question.

2013-04-16 Thread Brad Pitcher
I see what you're saying. Maybe you're looking for something more like this?

def method1(self, param1=sensible_default, param2=sensible_default,
param3=sensible_default):
print param1, param2, param3

The variable names must be specified in the method arguments like above if
you wish to reference them by name inside the method itself. With this
method, you will also need to call it with: model.method1(**params)

On Tue, Apr 16, 2013 at 9:59 PM, jayhalleaux  wrote:

> but if I did that then i would have a variable named kwargs.
>
> and it would be print kwargs['param1'], etc
>
> Why even unpack the dictionary?  I could just pass the dictionary instead.
>
>
> On Tuesday, April 16, 2013 11:08:42 PM UTC-4, Brad Pitcher wrote:
>
>> It should be:
>> model.method1(**params)
>> On Apr 16, 2013 7:49 PM, "jayhalleaux"  wrote:
>>
>>>  Not really a Django question but I'm trying to create a model method
>>> that does not have a fixed set of parameters.
>>>
>>> models.py
>>> Class Model_A(model.Model):
>>> ...
>>>
>>> def method1(self, **kwargs):
>>>
>>> print param1, param2, param3
>>>
>>>
>>>
>>> views.py
>>> params = dict(
>>>
>>> param1=something1,
>>> param2=something2,
>>>  param3=something3,
>>> ...
>>>
>>> )
>>>
>>> model.method1(params)
>>>
>>> In this example when I try to do something like this it states that I
>>> should have passed only 1 parameter instead of 2.
>>>
>>> I thought the whole point of using '**' to unpack dictionaries is so you
>>> don't have to have a fixed number of parameters.
>>>
>>> Is there something I am missing or am I doing this incorrect? First time
>>> I'm trying to create a method like this.  Normally I explicitly state all
>>> parameters.
>>>
>>> Any help is appreciated.
>>>
>>> --
>>> 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...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: djano user registration form and login(full example)

2013-04-16 Thread Avnesh Shakya
This error is occur when you're saving the member, not the user. When
creating the member, you are not assigning the user.


On Wed, Apr 17, 2013 at 10:45 AM, sachin  wrote:

> I m still stuck with
>
> Exception Type: IntegrityError
> Exception Value: column user_id is not unique
>
> Whenever I try to save, it throws the above error.
>
> I have attached files for reference, can someone help ??
>
>
>
> On Saturday, April 6, 2013 7:07:32 PM UTC+5:30, sachin wrote:
>>
>> Thanx Shawn,
>> *
>> *
>> UserCreationForm really helped.
>>
>> Now I have a different problem, I'm trying to add custom feilds to *auth
>> user *using 
>> storing-additional-**information-about-users
>> .
>> But now I m getting this error.
>>
>> Exception Type:IntegrityErrorException Value:
>>
>> column user_id is not unique
>>
>>
>>
>> This is my *models.py *file:
>> *
>> *
>> from django.db import models
>> from django.contrib.auth.models import User
>> from django.db.models.signals import post_save
>>
>> class UserProfile(models.Model):
>> user = models.OneToOneField(User)
>> sr_no = models.CharField(max_length=**10)
>>
>> def __unicode__(self):
>> return self.sr_no
>>
>> def create_user_profile(sender, instance, created, **kwargs):
>> if created:
>> UserProfile.objects.create(**user=instance)
>>
>> post_save.connect(create_user_**profile, sender=User)
>>
>> I have added *unique *field, but it does not make any difference. So far
>> I haven't got
>> any convincing answer.
>>
>> Any Idea ??
>> On Tuesday, April 2, 2013 12:49:52 AM UTC+5:30, Shawn Milochik wrote:
>>>
>>> Don't even worry about factories. They're for when you want a bunch of
>>> forms for the same model on the page at once.
>>>
>>> Use the UserCreationForm in django.contrib.auth.forms. It only accepts
>>> a username and password, so you can either subclass it to add the
>>> fields or make your own form and add it to your view so that they both
>>> appear in the same HTML form. You can validate both and do what you
>>> need to do.
>>>
>>> You definitely shouldn't be writing validation logic for the password
>>> and username and such -- that's what ModelForms are for.
>>>
>>> If you have more specific questions just ask.
>>>
>>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django-Registration/Custom Authentication Issue

2013-04-16 Thread Lee Hinde
Thanks Scott; that turned out to be the issue. I found those references and 
updated them and all is well.

On Apr 16, 2013, at 7:05 PM, Scott Anderson  wrote:

> Django registration is not compatible with custom user models in Django 1.5, 
> as it directly references django.contrib.auth.models.User in several places.
> 
> If you want to maintain your own copy you can swap those refs for those of 
> your own User model.
> 
> -scott
> 
> Via mobile phone
> 
> On Apr 16, 2013, at 9:59 PM, Rainy  wrote:
> 
>> 
>> 
>> 
>> 
>> On Sunday, April 14, 2013 9:49:32 PM UTC-4, Lee Hinde wrote:
>> I'm trying to do a 'simple' registration with just a user email and password 
>> required to create an account. I'm using django-registration with django 
>> 1.5.1 and have created a custom model and the custom model manager. 
>> 
>> I can hit all the registration forms just fine and have copied the example 
>> from the django docs (ignoring, temporarily, the admonition not to do that.).
>> 
>> I've created a custom backend in django-registration, basically to remove 
>> the username requirement. In fact, my custom backend is identical to the 
>> default, minus any references to the username.
>> 
>> When I try to create a new user (i.e, submit the form), from 
>> /accounts/register/ I get the following error:
>> 
>> AttributeError at /accounts/register/
>> Manager isn't available; User has been swapped for 'letters.PCSUser'
>> 
>> The full trace back is:
>> 
>> File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in 
>> get_response
>>   115. response = callback(request, *callback_args, 
>> **callback_kwargs)
>> File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in view
>>   68. return self.dispatch(request, *args, **kwargs)
>> File 
>> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
>>  in dispatch
>>   79. return super(RegistrationView, self).dispatch(request, *args, 
>> **kwargs)
>> File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in 
>> dispatch
>>   86. return handler(request, *args, **kwargs)
>> File 
>> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
>>  in post
>>   35. return self.form_valid(request, form)
>> File 
>> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
>>  in form_valid
>>   82. new_user = self.register(request, **form.cleaned_data)
>> File 
>> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/backends/pcs/views.py"
>>  in register
>>   80. 
>> password, site)
>> File "/Library/Python/2.7/site-packages/django/db/transaction.py" in inner
>>   223. return func(*args, **kwargs)
>> File 
>> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/models.py"
>>  in create_inactive_user
>>   78. new_user = User.objects.create_user( email, password)
>> File "/Library/Python/2.7/site-packages/django/db/models/manager.py" in 
>> __get__
>>   256. self.model._meta.object_name, self.model._meta.swapped
>> 
>> 
>> No doubt I've left out some needed component to show why this error is 
>> coming up, but I'm not sure what.  I'm grateful for any pointers on where I 
>> should be looking.
>> 
>> 
>> 
>> I believe the issue is that you need to define usermanager on your custom 
>> user, and
>> you will possibly need to inherit from django usermanager and override it to 
>> not
>> use username anywhere. But at the very least, you need to do something like:
>> 
>> import UserManager from wherever
>> class CustomUser(User):
>> objects = UserManager()
>> 
>> 
>>  -ak
>> 
>  

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: djano user registration form and login(full example)

2013-04-16 Thread sachin
I m still stuck with 

Exception Type: IntegrityError
Exception Value: column user_id is not unique

Whenever I try to save, it throws the above error.

I have attached files for reference, can someone help ??



On Saturday, April 6, 2013 7:07:32 PM UTC+5:30, sachin wrote:
>
> Thanx Shawn,
> *
> *
> UserCreationForm really helped.
>
> Now I have a different problem, I'm trying to add custom feilds to *auth 
> user *using 
> storing-additional-information-about-users
> .
> But now I m getting this error.
>
> Exception Type:IntegrityErrorException Value:
>
> column user_id is not unique
>
>
>
> This is my *models.py *file:
> *
> *
> from django.db import models
> from django.contrib.auth.models import User
> from django.db.models.signals import post_save
>
> class UserProfile(models.Model):
> user = models.OneToOneField(User)
> sr_no = models.CharField(max_length=10)
>
> def __unicode__(self):
> return self.sr_no
>
> def create_user_profile(sender, instance, created, **kwargs):
> if created:
> UserProfile.objects.create(user=instance)
>
> post_save.connect(create_user_profile, sender=User)
>
> I have added *unique *field, but it does not make any difference. So far 
> I haven't got
> any convincing answer. 
>
> Any Idea ??
> On Tuesday, April 2, 2013 12:49:52 AM UTC+5:30, Shawn Milochik wrote:
>>
>> Don't even worry about factories. They're for when you want a bunch of 
>> forms for the same model on the page at once. 
>>
>> Use the UserCreationForm in django.contrib.auth.forms. It only accepts 
>> a username and password, so you can either subclass it to add the 
>> fields or make your own form and add it to your view so that they both 
>> appear in the same HTML form. You can validate both and do what you 
>> need to do. 
>>
>> You definitely shouldn't be writing validation logic for the password 
>> and username and such -- that's what ModelForms are for. 
>>
>> If you have more specific questions just ask. 
>>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save

class UserProfile(models.Model):
user = models.OneToOneField(User)
serial_num = models.CharField(max_length=10)

def __unicode__(self):
return "%s" % self.user

def create_user_profile(sender, instance, created, **kwargs):  
if created == True:  
profile, created = UserProfile.objects.get_or_create(user=instance)

post_save.connect(create_user_profile, sender=User)
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
from models import UserProfile

class Register(UserCreationForm):
"""my form"""
serial_num = forms.CharField(max_length=10)

class Meta:
model = User
fields = ('username','first_name','last_name','email','serial_num','password1','password2',)


def save(self, commit=True):
if not commit:
raise NotImplementedError("Can't create User and UserProfile without database save")

user = super(UserCreationForm, self).save(commit=True)
user.username = self.cleaned_data["username"]
user.first_name = self.cleaned_data["first_name"]
user.last_name = self.cleaned_data["last_name"]
user.email = self.cleaned_data["email"]
user.set_password(self.cleaned_data["password1"])
user.is_active = True
# # if commit:
# user.save()
user_profile = UserProfile(user=user, serial_num=self.cleaned_data['serial_num'])
user_profile.save()
return user, user_profile
from django.shortcuts import render_to_response, HttpResponse
from django.template import RequestContext
from django.contrib.auth.models import User
from models import UserProfile
from forms import Register

def profile(request, pID):
users = User.objects.all()
user_profiles = users.get(id=pID)
user_profile = user_profiles.get_profile()
return render_to_response('profile.html',{'users':users,'user_profile':user_profile},context_instance=RequestContext(request))

# 

def register(request):
"""my register"""
if request.method == 'POST':
form = Register(request.POST)
if form.is_valid():
user = form.save()
success="sign_up_success"
return HttpResponse(success)
else:
form = Register()

return render

Re: Possible Basic kwargs question.

2013-04-16 Thread jayhalleaux
but if I did that then i would have a variable named kwargs.

and it would be print kwargs['param1'], etc

Why even unpack the dictionary?  I could just pass the dictionary instead.


On Tuesday, April 16, 2013 11:08:42 PM UTC-4, Brad Pitcher wrote:
>
> It should be:
> model.method1(**params)
> On Apr 16, 2013 7:49 PM, "jayhalleaux" > 
> wrote:
>
>> Not really a Django question but I'm trying to create a model method that 
>> does not have a fixed set of parameters.
>>
>> models.py
>> Class Model_A(model.Model):
>> ...
>>
>> def method1(self, **kwargs):
>>
>> print param1, param2, param3
>>
>>
>>
>> views.py
>> params = dict(
>>
>> param1=something1,
>> param2=something2,
>> param3=something3,
>> ...
>>
>> )
>>
>> model.method1(params)
>>
>> In this example when I try to do something like this it states that I 
>> should have passed only 1 parameter instead of 2.
>>
>> I thought the whole point of using '**' to unpack dictionaries is so you 
>> don't have to have a fixed number of parameters.
>>
>> Is there something I am missing or am I doing this incorrect? First time 
>> I'm trying to create a method like this.  Normally I explicitly state all 
>> parameters.
>>
>> Any help is appreciated.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Possible Basic kwargs question.

2013-04-16 Thread Brad Pitcher
It should be:
model.method1(**params)
On Apr 16, 2013 7:49 PM, "jayhalleaux"  wrote:

> Not really a Django question but I'm trying to create a model method that
> does not have a fixed set of parameters.
>
> models.py
> Class Model_A(model.Model):
> ...
>
> def method1(self, **kwargs):
>
> print param1, param2, param3
>
>
>
> views.py
> params = dict(
>
> param1=something1,
> param2=something2,
> param3=something3,
> ...
>
> )
>
> model.method1(params)
>
> In this example when I try to do something like this it states that I
> should have passed only 1 parameter instead of 2.
>
> I thought the whole point of using '**' to unpack dictionaries is so you
> don't have to have a fixed number of parameters.
>
> Is there something I am missing or am I doing this incorrect? First time
> I'm trying to create a method like this.  Normally I explicitly state all
> parameters.
>
> Any help is appreciated.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Possible Basic kwargs question.

2013-04-16 Thread jayhalleaux
Not really a Django question but I'm trying to create a model method that 
does not have a fixed set of parameters.

models.py
Class Model_A(model.Model):
...

def method1(self, **kwargs):

print param1, param2, param3



views.py
params = dict(

param1=something1,
param2=something2,
param3=something3,
...

)

model.method1(params)

In this example when I try to do something like this it states that I 
should have passed only 1 parameter instead of 2.

I thought the whole point of using '**' to unpack dictionaries is so you 
don't have to have a fixed number of parameters.

Is there something I am missing or am I doing this incorrect? First time 
I'm trying to create a method like this.  Normally I explicitly state all 
parameters.

Any help is appreciated.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django-Registration/Custom Authentication Issue

2013-04-16 Thread Scott Anderson
Django registration is not compatible with custom user models in Django
1.5, as it directly references django.contrib.auth.models.User in several
places.

If you want to maintain your own copy you can swap those refs for those of
your own User model.

-scott

Via mobile phone

On Apr 16, 2013, at 9:59 PM, Rainy  wrote:





On Sunday, April 14, 2013 9:49:32 PM UTC-4, Lee Hinde wrote:
>
> I'm trying to do a 'simple' registration with just a user email and
> password required to create an account. I'm using django-registration with
> django 1.5.1 and have created a custom model and the custom model manager.
>
> I can hit all the registration forms just fine and have copied the example
> from the django docs (ignoring, temporarily, the admonition not to do
> that.).
>
> I've created a custom backend in django-registration, basically to remove
> the username requirement. In fact, my custom backend is identical to the
> default, minus any references to the username.
>
> When I try to create a new user (i.e, submit the form), from
> /accounts/register/ I get the following error:
>
> AttributeError at /accounts/register/
> Manager isn't available; User has been swapped for 'letters.PCSUser'
>
> The full trace back is:
>
> File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in
> get_response
>   115. response = callback(request,
> *callback_args, **callback_kwargs)
> File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in
> view
>   68. return self.dispatch(request, *args, **kwargs)
> File
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
> in dispatch
>   79. return super(RegistrationView, self).dispatch(request,
> *args, **kwargs)
> File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in
> dispatch
>   86. return handler(request, *args, **kwargs)
> File
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
> in post
>   35. return self.form_valid(request, form)
> File
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
> in form_valid
>   82. new_user = self.register(request, **form.cleaned_data)
> File
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/backends/pcs/views.py"
> in register
>   80.
> password, site)
> File "/Library/Python/2.7/site-packages/django/db/transaction.py" in inner
>   223. return func(*args, **kwargs)
> File
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/models.py"
> in create_inactive_user
>   78. new_user = User.objects.create_user( email, password)
> File "/Library/Python/2.7/site-packages/django/db/models/manager.py" in
> __get__
>   256. self.model._meta.object_name, self.model._meta.swapped
>
>
> No doubt I've left out some needed component to show why this error is
> coming up, but I'm not sure what.  I'm grateful for any pointers on where I
> should be looking.
>
>
>
I believe the issue is that you need to define usermanager on your custom
user, and
you will possibly need to inherit from django usermanager and override it
to not
use username anywhere. But at the very least, you need to do something like:

import UserManager from wherever
class CustomUser(User):
objects = UserManager()


 -ak

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django-Registration/Custom Authentication Issue

2013-04-16 Thread Rainy




On Sunday, April 14, 2013 9:49:32 PM UTC-4, Lee Hinde wrote:
>
> I'm trying to do a 'simple' registration with just a user email and 
> password required to create an account. I'm using django-registration with 
> django 1.5.1 and have created a custom model and the custom model manager. 
>
> I can hit all the registration forms just fine and have copied the example 
> from the django docs (ignoring, temporarily, the admonition not to do 
> that.). 
>
> I've created a custom backend in django-registration, basically to remove 
> the username requirement. In fact, my custom backend is identical to the 
> default, minus any references to the username.
>
> When I try to create a new user (i.e, submit the form), from 
> /accounts/register/ I get the following error:
>
> AttributeError at /accounts/register/
> Manager isn't available; User has been swapped for 'letters.PCSUser'
>
> The full trace back is:
>
> File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in 
> get_response
>   115. response = callback(request, 
> *callback_args, **callback_kwargs)
> File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in 
> view
>   68. return self.dispatch(request, *args, **kwargs)
> File 
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
>  
> in dispatch
>   79. return super(RegistrationView, self).dispatch(request, 
> *args, **kwargs)
> File "/Library/Python/2.7/site-packages/django/views/generic/base.py" in 
> dispatch
>   86. return handler(request, *args, **kwargs)
> File 
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
>  
> in post
>   35. return self.form_valid(request, form)
> File 
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/views.py"
>  
> in form_valid
>   82. new_user = self.register(request, **form.cleaned_data)
> File 
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/backends/pcs/views.py"
>  
> in register
>   80. 
> password, site)
> File "/Library/Python/2.7/site-packages/django/db/transaction.py" in inner
>   223. return func(*args, **kwargs)
> File 
> "/Users/leehinde/Documents/Clients/ProfessionalCreditSolutions/pcs/pcs/registration/models.py"
>  
> in create_inactive_user
>   78. new_user = User.objects.create_user( email, password)
> File "/Library/Python/2.7/site-packages/django/db/models/manager.py" in 
> __get__
>   256. self.model._meta.object_name, self.model._meta.swapped
>
>
> No doubt I've left out some needed component to show why this error is 
> coming up, but I'm not sure what.  I'm grateful for any pointers on where I 
> should be looking.
>
>
>
I believe the issue is that you need to define usermanager on your custom 
user, and
you will possibly need to inherit from django usermanager and override it 
to not
use username anywhere. But at the very least, you need to do something like:

import UserManager from wherever
class CustomUser(User):
objects = UserManager()


 -ak

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread frocco
I have been looking at the django-newsletter, but can see no way to send a 
newsletter by user group

On Tuesday, April 16, 2013 6:04:18 PM UTC-4, frocco wrote:
>
> Hello,
>
> I am using django 1.5.1 and trying to dumpdata.
>
> How can I fix this?
>
> Thanks
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to get email messageId when using Amazon SES in Django?

2013-04-16 Thread krdeepak


I am using Amazon SNS to send notification when an email bounces. I need to 
store email messageId when sending the email, so that I can match it with 
notification and see which email delivery failed. Django send_mail seems to 
be returning number of emails sent. How can I get the messageId of the 
email sent using Amazon SES?

EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com'

http://stackoverflow.com/questions/16042918/how-to-get-email-messageid-when-using-amazon-ses-in-django

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread frocco
Yes, I just found out django-campaign is causing the error.
There are a few forks of this, not sure what I should do.

On Tuesday, April 16, 2013 6:04:18 PM UTC-4, frocco wrote:
>
> Hello,
>
> I am using django 1.5.1 and trying to dumpdata.
>
> How can I fix this?
>
> Thanks
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread Larry Martell
Did you try what was suggested there? i.e. running it with '--database default'


On Tue, Apr 16, 2013 at 4:58 PM, frocco  wrote:
> Thanks Larry,
>
> I read this, but not sure how to fix it.
>
> On Tuesday, April 16, 2013 6:04:18 PM UTC-4, frocco wrote:
>>
>> Hello,
>>
>> I am using django 1.5.1 and trying to dumpdata.
>>
>> How can I fix this?
>>
>> Thanks
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread frocco
Thanks Larry,

I read this, but not sure how to fix it.

On Tuesday, April 16, 2013 6:04:18 PM UTC-4, frocco wrote:
>
> Hello,
>
> I am using django 1.5.1 and trying to dumpdata.
>
> How can I fix this?
>
> Thanks
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread Larry Martell
This may help you:

http://stackoverflow.com/questions/10405978/dumpdata-too-many-arguments

On Tue, Apr 16, 2013 at 4:36 PM, frocco  wrote:
> Sorry, here it is.
>
> python manage.py dumpdata > django_data.json
>
> On Tuesday, April 16, 2013 6:04:18 PM UTC-4, frocco wrote:
>>
>> Hello,
>>
>> I am using django 1.5.1 and trying to dumpdata.
>>
>> How can I fix this?
>>
>> Thanks
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread frocco
Sorry, here it is.

python manage.py dumpdata > django_data.json

On Tuesday, April 16, 2013 6:04:18 PM UTC-4, frocco wrote:
>
> Hello,
>
> I am using django 1.5.1 and trying to dumpdata.
>
> How can I fix this?
>
> Thanks
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread Jonathan Baker
Hello,

For starters, it'd help if you would provide us with the command you ran
(so we're not guessing).

Jonathan


On Tue, Apr 16, 2013 at 4:04 PM, frocco  wrote:

> Hello,
>
> I am using django 1.5.1 and trying to dumpdata.
>
> How can I fix this?
>
> Thanks
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread frocco
Hello,

I am using django 1.5.1 and trying to dumpdata.

How can I fix this?

Thanks

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: "ImportError: No module named django"

2013-04-16 Thread Nathan Hall
Ok, that was it, being completely unfamiliar with the Mac Terminal, I was
in the wrong directory. I navigated to the proper directory and got it
installed. Thanks for the help guys!

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Date from DateTimeField vs date from model method: foreign key DateTimeField

2013-04-16 Thread Mike Doroshenko II

Gabriel [SGT] wrote:

On Fri, Apr 12, 2013 at 2:47 PM, Mike Doroshenko II
 wrote:

In my attached models.py

Please, don't attach code, use a paste service or similar to view the
code online.


Ok, yeah I suppose that would save storage space and bandwidth 
considering the fact I have a few copied of the same email (From my sent 
folder and I'm getting some emails twice).



the time last modified on the latest object that has a foreign key to it.

So when I made a new document, in the admin interface I see April 11, 2013,
8:24 p.m. for the Created column and 2013-04-11 20:24:36.799167 for the Last
Modified column.

Also I can click to sort the results by Created date, but not by last
modified date.


I'm afraid any reason why it's different. Are you using your own ModelAdmin ?


class DocAdmin(admin.ModelAdmin):

list_display = ['name','created','last_modified']


Additionally in the same file in the model method I am using a for-loop to
get the value for Last Modified. I imagine going through each object just to
pull the data from the last one isn't very efficient and pretty redundant. I
tried to just pull the last object directly but am getting an error:

I modified your code accordingly http://pastebin.com/7NisAVfN

be aware that if a 'Piece' matching that criteria doesn't exists, it
will raise a DoesNotExist exception, maybe you'll want to catch it.

psst ->> https://docs.djangoproject.com/en/dev/ref/models/querysets/
Hmm so it was caused by a Document with no pieces. The code you provided 
simply returned None for that one :)


Thanks,
Mike

--
Mike Doroshenko, Junior Sys Admin
TecKnoQuest Inc.
mi...@tecknoquest.com
www.tecknoquest.com

--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Date from DateTimeField vs date from model method: foreign key DateTimeField

2013-04-16 Thread Gabriel [SGT]
On Fri, Apr 12, 2013 at 2:47 PM, Mike Doroshenko II
 wrote:
> In my attached models.py

Please, don't attach code, use a paste service or similar to view the
code online.

> the time last modified on the latest object that has a foreign key to it.
>
> So when I made a new document, in the admin interface I see April 11, 2013,
> 8:24 p.m. for the Created column and 2013-04-11 20:24:36.799167 for the Last
> Modified column.
>
> Also I can click to sort the results by Created date, but not by last
> modified date.


I'm afraid any reason why it's different. Are you using your own ModelAdmin ?

>
> Additionally in the same file in the model method I am using a for-loop to
> get the value for Last Modified. I imagine going through each object just to
> pull the data from the last one isn't very efficient and pretty redundant. I
> tried to just pull the last object directly but am getting an error:

I modified your code accordingly http://pastebin.com/7NisAVfN

be aware that if a 'Piece' matching that criteria doesn't exists, it
will raise a DoesNotExist exception, maybe you'll want to catch it.

psst ->> https://docs.djangoproject.com/en/dev/ref/models/querysets/

> --
> Mike Doroshenko, Junior Sys Admin

Regards

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django auth user - difference between last login and now

2013-04-16 Thread Jaimin Patel
Any suggestion on this question? 

On Friday, April 12, 2013 10:35:54 AM UTC-4, Jaimin Patel wrote:
>
> Hello,
>
> I would like to provide some instructions if user come after gap of 1 week 
> or so. I was hoping that I can do that by -
>
> (datetime.now()-user.last_login) > timedelta(days=7)
>
> Though by the time it comes to my view last login is already updated by 
> auth user model of django, so in my application code when I try to find 
> this difference it always comes 0 day because last_login time is already 
> updated with now datetime. 
>
> Is there any other way to get this information? 
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django - Tracking Usage by each registered user and anonymous user

2013-04-16 Thread Jaimin Patel
Hello,

I would like to gather the information on how many minutes/hours spent by 
anonymous users and registered users on my app. On quick google I found few 
ways to do it -

1. Django-tracking : https://github.com/codekoala/django-tracking
2. Django-tracking2 : https://github.com/bruth/django-tracking2
(Though I am little confused on difference between this two apart from 
one (tracking2) keeps history and activity or user and other(tracking) also 
shows geo location, and real time information etc.)

3. mixpanel-celery:  http://weswinham.com/mixpanel-celery/introduction.html#

Can someone suggest which one will be better to use? or any other better 
solution?

- django-tracking2 seems good enough with minimum configuration.
- I am not interested in realtime details on where the users are active, If 
I can get cumulative number of hours spent by particular user on the 
app/per page, its good enough.

Thanks.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Extend django user model

2013-04-16 Thread Laurent David Deschambault
Hi,

I want to extend the existing user model and I have followed the 
instructions found in the Django documentation (
https://docs.djangoproject.com/en/dev/topics/auth/customizing/#extending-the-existing-user-model
).
My issue is that my additional fields (which are ForeignKey) cannot be 
blank or null. Even if I set them to blank = false and null = false, the 
admin site will still save the new user without any value attached to these 
additional fields.
Am I missing something here? I thought the admin site wouldn't allow it.

Thanks in advance

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Date from DateTimeField vs date from model method: foreign key DateTimeField

2013-04-16 Thread Mike Doroshenko II

Hello?

Mike Doroshenko II wrote:
In my attached models.py I have a class that has a model method to 
return the time last modified on the latest object that has a foreign 
key to it.


So when I made a new document, in the admin interface I see April 11, 
2013, 8:24 p.m. for the Created column and 2013-04-11 20:24:36.799167 
for the Last Modified column.


Also I can click to sort the results by Created date, but not by last 
modified date.


How can I sanitize the Last Modified field so that it appears like 
Created does and I can sort by it?


Additionally in the same file in the model method I am using a 
for-loop to get the value for Last Modified. I imagine going through 
each object just to pull the data from the last one isn't very 
efficient and pretty redundant. I tried to just pull the last object 
directly but am getting an error:



  TemplateSyntaxError at /admin/grace/document/

Caught IndexError while rendering: list index out of range

--
Mike Doroshenko, Junior Sys Admin
TecKnoQuest Inc.
mi...@tecknoquest.com
www.tecknoquest.com
--
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+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


--
Mike Doroshenko, Junior Sys Admin
TecKnoQuest Inc.
mi...@tecknoquest.com
www.tecknoquest.com

--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


from django.db import models
import datetime

class Document(models.Model):
name = models.CharField(max_length=22)
created = models.DateTimeField(auto_now_add=True)

def __unicode__(self):
	return self.name

def last_modified(self):
	for m in self.piece_set.all():
	global x
	x = m.last_modified
	date = x
	#obj = self.piece_set.order_by("-id")[0]
	#date = obj.last_modified
	# Causes IndexError when rendering template in admin interface.
	return date

class Piece(models.Model):
sort_int = models.IntegerField()
doc = models.ForeignKey(Document)
text = models.TextField()
last_modified = models.DateTimeField(auto_now=True)

def __unicode__(self):
	return "%s:   %d" % (self.doc.name, self.sort_int)


How to translate database content?

2013-04-16 Thread Cody Scott
I want the end user of the site to be able to view the site in different 
languages.

I have marked the static text in my templates for translation. I have not 
marked the verbose_names because they are used in the admin which the end 
user will not have access to.

But I just realized that the actually content in the database needs to be 
translated. If it was a blog site the blog posts which are stored in the 
database would also need to be translated.

How do I mark them for translation?

How can I see the site in a different language. In the tutorial is says you 
can see the admin section in a different language how do I do that?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-16 Thread Jeff Hsu
First, check to see if you have 3 tables, social_auth_association,
social_auth_nonce, and social_auth_usersocialauth.  If not, you need to
create those DB tables.  SyncDB did not work for me.  I had south
installed.  So, you just do use south to create proper schema for those DB
tables.  Some tutorial on south:
http://south.readthedocs.org/en/latest/tutorial/part1.html

Jeff


On Tue, Apr 16, 2013 at 8:35 AM, Alex Ksenzov  wrote:

> Hi Jeff .I have this problem too, but still can't figure out. Can you
>> please provide resolving more detail and step by step please. Thanks.
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/9YkrCD2veRQ/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using postgres Users as django users

2013-04-16 Thread Avraham Serour
So you are saying that each user models will be using the same database but
with different connection settings?

I believe you can create each and every connection setting on your
databases inside settings.py, each one would use the same database but a
different user.
When creating an object specify it to use the corresponding database


On Tue, Apr 16, 2013 at 5:27 PM, Maximilian Tyrtania <
maximilian.tyrta...@googlemail.com> wrote:

> I looked at that a bit, thanks, the problem is that I can well use my pg
> server to do the authentication, but I still can't talk django into using
> the database connection for this particurlar user (hopefully I'm just not
> aware of the solution).
> You see, lots of my models in models.py are based on database views in
> postgres, which in turn make use of the current_user() function. This is
> why I need django to use the correct connection settings.
>
> Am Dienstag, 16. April 2013 14:51:18 UTC+2 schrieb אברהם סרור:
>
>> I believe you could create a custom auth that relies on the postgres auth
>> system
>>
>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Problem with creating a one-to-one instance

2013-04-16 Thread Carsten Fuchs

Hi all,

I'm probably overlooking something very simple, but still cannot explain 
what the code below does wrong:


With these models:

class Vorblendplan(models.Model):
# ...
pass

class Mitarbeiter(models.Model):
# ...
vbp = models.OneToOneField(Vorblendplan, null=True, blank=True, 
on_delete=models.SET_NULL)


I try to make sure that a Mitarbeiter object has a proper (not None) vbp 
instance. In the manage.py shell:


>>> ma = Mitarbeiter.objects.get(key="F426")
>>> ma.vbp  # ok, initially "None"
>>> ma.vbp = Vorblendplan()
>>> ma.vbp.save()
>>> ma.save()

>>> ma = Mitarbeiter.objects.get(key="F426")
>>> ma.vbp  # Why still "None"??

This, in contrast, works:

>>> ma = Mitarbeiter.objects.get(key="F426")
>>> ma.vbp  # "None"
>>> v = Vorblendplan()
>>> v.save()
>>> ma.vbp = v
>>> ma.save()

>>> ma = Mitarbeiter.objects.get(key="F426")
>>> ma.vbp  # ok, as expected


Why does the first example not work?

Thank you very much, and best regards,
Carsten

--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-social-auth problem with facebook

2013-04-16 Thread Alex Ksenzov

>
> Hi Jeff .I have this problem too, but still can't figure out. Can you 
> please provide resolving more detail and step by step please. Thanks.
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Creating a Djang Webpage

2013-04-16 Thread Javier Guerra Giraldez
On Tue, Apr 16, 2013 at 7:48 AM, Augusto Santos
 wrote:
> I have alredy read part of the tutorial at django's site and read a little
> bit of the documentation.

first of all, do the tutorial.  all of it.  if you get stuck at any
point, ask for help here.  but do it.

after that, it's good to read most of the docs too; but you can start
with whatever you're curious with.  it's also the point where other
books can help.  I haven't read any one beyond the DjangoBook, but
it's somewhat outdated.

then, you'll be mostly able to do whatever you want, and if you feel
you need any help, this is the place to ask.

but first do the tutorial.


>However, a friend of mine told me that the latest version of Django, that is
> 1.5.1, have little documentation, so I started using 1.4.5.

that's not completely true, if you go to the docs site and choose 1.5
you get the whole set of docs.  In fact, since Django has a very
strict forward compatibility policy, the docs for 1.5 are almost the
same as for 1.4 plus the extra parts, which are really well
documented.

the only sharp edges you could find in 1.5 are with regards to Python
3.3, which is supported but there's still not so much experience or
compatible packages as with 2.7


welcome to Django!

--
Javier

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Creating a Djang Webpage

2013-04-16 Thread Frankline
Google is your friend.

An example:
http://stackoverflow.com/questions/5871730/need-a-minimal-django-file-upload-example


On Tue, Apr 16, 2013 at 3:48 PM, Augusto Santos
wrote:

> Hey guys,
>
> So, I am new in Django framework and I would know how to make a simple
> page with this powerful tool. I have alredy read part of the tutorial at
> django's site and read a little bit of the documentation. However, a friend
> of mine told me that the latest version of Django, that is 1.5.1, have
> little documentation, so I started using 1.4.5.
> What I need is to make a simple webpage for my final project and I need a
> page that have just one button to make uploads, the code that would be
> uploaded will be compiled and the user who is uploading would received an
> image of the file compiled. About the compilation is with me :)
> The problem that I am facing is that I am not finding any document
> straightfoward to what I want. I don't want to use a template of a blog.
> Actually, I nedd a simple template that I would put a button to make an
> upload. What do you advice me to do? What should I read? I downloaded the
> ebook "Sam teached you Django in 24hours" Is it good? I really need help!!!
> I need to make it faster!
>
> I am grateful for your help.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to clear all session variables without getting logged out?

2013-04-16 Thread Cody Scott
I am trying to clear all of the session variables but not logout the 
current user.

user = request.session.get('member_id', None)
request.session.flush()
request.session.modified = True
request.session['member_id'] = user
request.session.modified = True


Will this also affect other users of the site?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using postgres Users as django users

2013-04-16 Thread Maximilian Tyrtania
I looked at that a bit, thanks, the problem is that I can well use my pg 
server to do the authentication, but I still can't talk django into using 
the database connection for this particurlar user (hopefully I'm just not 
aware of the solution).  
You see, lots of my models in models.py are based on database views in 
postgres, which in turn make use of the current_user() function. This is 
why I need django to use the correct connection settings.

Am Dienstag, 16. April 2013 14:51:18 UTC+2 schrieb אברהם סרור:
>
> I believe you could create a custom auth that relies on the postgres auth 
> system
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance

2013-04-16 Thread Kishan Mehta
Ok, Thank you Amyth.

>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance

2013-04-16 Thread Kishan Mehta

Ok thank you Serdar Dalgıç.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re:

2013-04-16 Thread vinoth job
actually appsembler  is an application that will provide hosting service
for mezzanine based sites and apps .but this is also not successfully
deploying .


On Tue, Apr 16, 2013 at 5:31 PM, Anton Parkhomenko wrote:

> Actually, I don't think that any of Django-based CMS' (mezzazine,
> django-cms or feincms) is something like drupal or wordpress. Anyway you
> need to know django or python at some level, because there isn't plenty of
> ready-to-use themes and plugins. You always need to develop some parts by
> yourself.
>
>
> On Tuesday, April 16, 2013 6:12:49 PM UTC+8, vinoth job wrote:
>>
>> i installed mezzanine.and  this is django based cms .by using we can
>> create websites .like what we can do with drupal and wordpress. my doubt is
>> how to get host for my mezzanine project .is it anything that i want to
>> change in codings.or is there any websites providing hostings for mezzanine
>> projects.and i need your help  to start my  website using mezzanine
>>
>> and currently i posting my articles in localhost : 127.0.0.1:8000.and
>> there is no usage in this . to get hosting what i seriously want to do
>>
>> so this is http://mezzanine.jupo.org/  .
>>
>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Creating a Djang Webpage

2013-04-16 Thread Augusto Santos
Hey guys,

So, I am new in Django framework and I would know how to make a simple page 
with this powerful tool. I have alredy read part of the tutorial at 
django's site and read a little bit of the documentation. However, a friend 
of mine told me that the latest version of Django, that is 1.5.1, have 
little documentation, so I started using 1.4.5.
What I need is to make a simple webpage for my final project and I need a 
page that have just one button to make uploads, the code that would be 
uploaded will be compiled and the user who is uploading would received an 
image of the file compiled. About the compilation is with me :)
The problem that I am facing is that I am not finding any document 
straightfoward to what I want. I don't want to use a template of a blog. 
Actually, I nedd a simple template that I would put a button to make an 
upload. What do you advice me to do? What should I read? I downloaded the 
ebook "Sam teached you Django in 24hours" Is it good? I really need help!!! 
I need to make it faster!

I am grateful for your help.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django search

2013-04-16 Thread Daniel Roseman
On Saturday, 13 April 2013 16:59:49 UTC+1, Harjot Mann wrote:

> hello friends 
>
> i have made a project on studnt dmc records in django...in which i search 
> for student' s dmcs using roll number..it works fine
> but the problem is that when i am typing a fake roll number which is not 
> existing..it is showing me an error like given in the pic
>
>
So, your trouble is that when you type in a number that is not found, 
Django shows you a not found error? And to prove that, you post a 
screenshot of the not found error, rather than posting any of the actual 
code, or describing what you would like to happen instead?

If you want to be helped, you have to help yourself.
--
DR.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using postgres Users as django users

2013-04-16 Thread Avraham Serour
I believe you could create a custom auth that relies on the postgres auth
system


On Tue, Apr 16, 2013 at 3:00 PM, Maximilian Tyrtania <
maximilian.tyrta...@googlemail.com> wrote:

> Hi there,
>
> This is my 1st post, so please be gentle...
>
> I'm looking into using django as web front end to my Postgres DB. Now in
> my PG server i have a number of db users (created via create user xy...),
> and I would like to use these users as well in my django->postgres
> connections. Obviously djangos concept of having a single user hard coded
> in settings.py doesn't cooperate with this idea. Is there a way to let the
> user give his name and password, and then tell django to use those
> credentials with the pgconnection?
>
> Best wishes from Berlin,
> Maximilian Tyrtania
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance

2013-04-16 Thread Amyth Arora
POST and GET here are not actually methods but dictionaries which are
attributes of the request object. `.get()` method is applicable to any
dictionary object. You can check the official docs here
http://docs.python.org/2/library/stdtypes.html#dict.get to know more about
the get method.

Also, If you are looking to learn more about methods available in django, I
would suggest you to read through the documentation here
https://docs.djangoproject.com/en/1.5/. In case you have confusion about
any specific methods it's always a good idea to browse through the source
to get a better understanding.


On Tue, Apr 16, 2013 at 6:10 PM, Serdar Dalgic  wrote:

> On Tue, Apr 16, 2013 at 3:32 PM, Kishan Mehta 
> wrote:
> > Hi, I am new to django. while learning from django book i came across
> > request.POST.get()
> > request.GET()
> >
> > etc methods.
> >
> > anyone can tell a where i can read more about this methods.
> >
>
> Take a look at this documentation
> https://docs.djangoproject.com/en/dev/ref/request-response/ (select
> the django version from the down right part of the page, the link I
> sent is the development version.)
>
> > Also in future if i want to know which method does what exactly where to
> > go..
> >  I tried google but could not  find any useful thing.
> >
>
> I'd strongly recommend you to complete the tutorial
> https://docs.djangoproject.com/en/1.5/intro/tutorial01/ and make sure
> that you understand every aspect well.
>
> --
> - Serdar Dalgıç 
> FLOSS Developer, Life & Nature Hacker
> twitter: https://twitter.com/serdaroncode
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @mytharora
http://techstricks.com/

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guidance

2013-04-16 Thread Serdar Dalgic
On Tue, Apr 16, 2013 at 3:32 PM, Kishan Mehta  wrote:
> Hi, I am new to django. while learning from django book i came across
> request.POST.get()
> request.GET()
>
> etc methods.
>
> anyone can tell a where i can read more about this methods.
>

Take a look at this documentation
https://docs.djangoproject.com/en/dev/ref/request-response/ (select
the django version from the down right part of the page, the link I
sent is the development version.)

> Also in future if i want to know which method does what exactly where to
> go..
>  I tried google but could not  find any useful thing.
>

I'd strongly recommend you to complete the tutorial
https://docs.djangoproject.com/en/1.5/intro/tutorial01/ and make sure
that you understand every aspect well.

-- 
- Serdar Dalgıç 
FLOSS Developer, Life & Nature Hacker
twitter: https://twitter.com/serdaroncode

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Guidance

2013-04-16 Thread Kishan Mehta
Hi, I am new to django. while learning from django book i came across
request.POST.get()
request.GET()

etc methods.

anyone can tell a where i can read more about this methods.

Also in future if i want to know which method does what exactly where to
go..
 I tried google but could not  find any useful thing.

Thanks ,
Kishan

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Using postgres Users as django users

2013-04-16 Thread Maximilian Tyrtania
Hi there,

This is my 1st post, so please be gentle...

I'm looking into using django as web front end to my Postgres DB. Now in my 
PG server i have a number of db users (created via create user xy...), and 
I would like to use these users as well in my django->postgres connections. 
Obviously djangos concept of having a single user hard coded in settings.py 
doesn't cooperate with this idea. Is there a way to let the user give his 
name and password, and then tell django to use those credentials with the 
pgconnection?

Best wishes from Berlin,
Maximilian Tyrtania

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re:

2013-04-16 Thread Anton Parkhomenko
Actually, I don't think that any of Django-based CMS' (mezzazine, 
django-cms or feincms) is something like drupal or wordpress. Anyway you 
need to know django or python at some level, because there isn't plenty of 
ready-to-use themes and plugins. You always need to develop some parts by 
yourself.

On Tuesday, April 16, 2013 6:12:49 PM UTC+8, vinoth job wrote:
>
> i installed mezzanine.and  this is django based cms .by using we can 
> create websites .like what we can do with drupal and wordpress. my doubt is 
> how to get host for my mezzanine project .is it anything that i want to 
> change in codings.or is there any websites providing hostings for mezzanine 
> projects.and i need your help  to start my  website using mezzanine
>
> and currently i posting my articles in localhost : 127.0.0.1:8000.and 
> there is no usage in this . to get hosting what i seriously want to do
>
> so this is http://mezzanine.jupo.org/  .
>  

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using .extra after using .annotate is not working

2013-04-16 Thread Venkatraman S
On Tue, Apr 16, 2013 at 1:39 PM, Shabda Raaj  wrote:

> I am trying to get a field in a queryset which depends on the result
> of the annotations. I tried using extra on an annotated queryset,
> which doesn't seem to work.
>

Does something like this work? .annotate(average_=Avg('model__'))

https://docs.djangoproject.com/en/1.5/topics/db/aggregation/

Venkat
http://twitter.com/venkasub

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[no subject]

2013-04-16 Thread vinoth job
i installed mezzanine.and  this is django based cms .by using we can create
websites .like what we can do with drupal and wordpress. my doubt is how to
get host for my mezzanine project .is it anything that i want to change in
codings.or is there any websites providing hostings for mezzanine
projects.and i need your help  to start my  website using mezzanine

and currently i posting my articles in localhost : 127.0.0.1:8000.and there
is no usage in this . to get hosting what i seriously want to do

so this is http://mezzanine.jupo.org/  .

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Using .extra after using .annotate is not working

2013-04-16 Thread Shabda Raaj
I am trying to get a field in a queryset which depends on the result
of the annotations. I tried using extra on an annotated queryset,
which doesn't seem to work.

Lets say my models looks like this:

class Foo(models.Model):
name = models.CharField(...)

class FooData(models.Model):
foo = models.ForeignKey(Foo)
sales = models.PositiveIntegerField()
items_sold = models.PositiveIntegerField()

I have a queryset of Foo objects

some_foos = Foo.objects.filter()

I have annotated it to get the sum on FooData.

some_foos.object.annotate(
total_sales=Sum("foodata__sales"),
total_items_sold=Sum("foodata__items_sold")
)

Now I want to get the average price for which I am trying to
use .extra. They don't seem to work. (I have looked the generated sql
queries).

#Wont work, fields not defined yet.
some_foos.object.annotate(
total_sales=Sum("foodata__sales"),
total_items_sold=Sum("foodata__items_sold")
).extra(select={'price_avg': "total_sales/total_items_sold"})

#Wont work, this adds an extra clause in group by
price_avg = "SUM(appname_foodata.sales)/
SUM(appname_foodata.items_sold)"
some_foos.object.annotate(
total_sales=Sum("foodata__sales"),
total_items_sold=Sum("foodata__items_sold")
)



-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django IO exceptions through times

2013-04-16 Thread Anton Parkhomenko
UPD. I found that on TemplateDoesNotExist Django notice me that templates 
are actually exists  (3rd and 29th strings). 
But why they didn't not loaded?

On Tuesday, April 16, 2013 2:51:18 PM UTC+8, Anton Parkhomenko wrote:
>
> Hi.
> I have a strange problem with Django. It raise exceptions like 
> TemplateDoesNotExist or ImportError, while actually files and modules are 
> exists and have proper rights. This error appears not everytime, but in 
> ~1/20 cases (not regular), thus I thought about to blame my VDS, but other 
> projects with older software works correct on this server.
> On this project I'm using Django 1.4.4, django-CMS 2.4.0-RC1 and uWSGI 
> 1.2.6 (for all other projects) with virtualenvs.
> How do you think, what's the problem?
> P.S. There's a not small set of "lost" files. They're all the same almost 
> each time, only 6-8 of templates and modules.
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Handling duplicate js/css in forms media with included templates

2013-04-16 Thread Carsten Reimer


Hi,

maybe django-sekizai (https://github.com/ojii/django-sekizai) might help 
you out. It let's you define blocks (especially for javascript and css) 
in subtemplates and takes care that no entry is doubled.


The docs are here:
http://django-sekizai.readthedocs.org/en/latest/

We use it in a current project and with some fiddeling it even works 
with django-compressor.


Hth

with best regards

Carsten Reimer



Hi,

I have seen some discussion in this group on how to handle duplicate 
form.media in template includes.


I have the following the following base.html with scripts at the end of 
the body. I am following h5bp convention:


src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
window.jQuery || document.write('