Re: [feincms] [ANN]: FeinCMS v1.7

2013-02-27 Thread Matthias Kestenholz
On Wed, Feb 27, 2013 at 8:16 AM, Andi Albrecht wrote:

> Hi Matthias,
>
> first of all thanks for the new release and all the work (this goes to
> all developers of course!).
>
> On Tue, Feb 26, 2013 at 10:00 PM, Matthias Kestenholz 
> wrote:
> >
> >
> > Compatibility with Django and other apps
> > 
> >
> > FeinCMS 1.7 requires Django 1.4.
>
> Should that be read as requires at least Django 1.4? IOW is FeinCMS
> 1.7 tested with Django 1.5?
>
>
Yes, of course! I'll fix the docs to point that out. The release notes were
written when 1.5 wasn't released yet.

Thanks,
Matthias

-- 
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 1.5 & Python 3 - porting packages to Python3

2013-02-27 Thread Tom Christie
Hi Thomas,

There's movement on getting Py3k compatibility into pillow.
See this, 
and associated tickets: https://github.com/python-imaging/Pillow/issues/61

> Are there any focus in the community on getting packages ready for 
python3?

Sure, I'm seeing several projects recently updated or actively working on 
it now.

I'm sure there'll be a lot of acceleration on Py3k compatible Django 
packages now that 1.5 has been released. :)

Cheers,

  Tom


On Friday, 15 February 2013 08:35:36 UTC, Thomas Weholt wrote:
>
> Hi, 
>
> As a Norwegian user of Django and python user I've spent countless 
> hours dealing with unicode-problems. As I ported DSE to Python 3 a 
> while ago I also discovered that all my unicode problems were solved 
> if I started using Python 3. Probably old news to most of you, or 
> maybe not even relevant, but it's a make-or-break-situation for me and 
> my potential users and customers. So all my latest django-based 
> projects have been developed using Python 3.3 with great success. 
>
> But the only problem now is the lack of python-packages supporting 
> Python 3, mainly PIL ( or the pil-fork pillow ), django-debug-toolbar, 
> django-celery etc. 
>
> Are there any focus in the community on getting packages ready for 
> python3? 
>
> -- 
> Mvh/Best regards, 
> Thomas Weholt 
> http://www.weholt.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.




DjangoCon regular sales starts today at 4pm CET!

2013-02-27 Thread Ola Sitarska
Hi everyone! 

I'm Ola, one of the main organizers of upcoming DjangoCon Europe 
conference. I just wanted to let you know that we're starting to sell 
regular tickets to the conference today at 4pm CET prompt! Tickets are 
available here: http://tickets.djangocon.eu/

We have also recently announced venue , 
schedule , 
talksand 
speakers . We would love to hear you 
thoughts and ideas for DjangoCon -- please, let us know what we can improve 
to make this event ever more awesome :) 

Really looking forward to meet you in Warsaw!

--
Ola Sitarska
http://2013.djangocon.eu/

-- 
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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread Akshay Ramesh
Its really great to now about that  Hop it wil hav bettr features .

On Tue, Feb 26, 2013 at 11:05 PM, Thomas Weholt wrote:

> I've been using 1.5rc2 for a while now with no problems so getting a
> final of 1.5 is great news. I especially like the support for Python 3
> since it removes all of my unicode problems. Being a Norwegian
> programmer having to deal with those damn øæå-characters all the time
> has been a real pain. Now if only the django-debug-toolbar and PIL
> could be ported to Python 3 as well all my problems would be solved
> ;-)
>
> Great work!
>
> Thomas
>
> On Tue, Feb 26, 2013 at 10:56 PM, william ratcliff
>  wrote:
> > Kudos!   I'm really excited about this version and the new User model!!!
> >
> >
> > On Tue, Feb 26, 2013 at 3:08 PM, Mark Furbee 
> wrote:
> >>
> >> Woo-hoo! Awesome news. We really appreciate all the hard work you guys
> >> have been doing getting this version out.
> >>
> >> Thanks a million!
> >>
> >> Mark
> >>
> >>
> >> On Tue, Feb 26, 2013 at 11:44 AM, James Bennett 
> >> wrote:
> >>>
> >>> Yup, it's finally here!
> >>>
> >>> * Announcement blog post here:
> >>> https://www.djangoproject.com/weblog/2013/feb/26/15/
> >>> * Release notes here:
> https://docs.djangoproject.com/en/1.5/releases/1.5/
> >>> * Download it here: https://www.djangoproject.com/download/
> >>>
> >>> --
> >>> 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.
> >
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.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.




Begginer

2013-02-27 Thread Akshay Ramesh
Hi I am new to Djnago and would like to have some help from you. Where
should I start from ?

-- 
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 UserAdmin with GenericStackedInline in Django 1.5c2

2013-02-27 Thread Witold Greń
Hi, I have a problem UserAdmin with GenericStackedInline in Django 1.5c2.

#model.py

from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, 
PermissionsMixin

from django.conf import settings

#etc...


class Addresses(models.Model):

"""

Dane adresowe.

"""

name = models.CharField(max_length=200, verbose_name='Nazwa')

street = models.CharField(max_length=200, verbose_name='Ulica')

no_house = models.IntegerField(verbose_name='Numer budynku')

no_local = models.IntegerField(verbose_name='Numer lokalu', blank=True, 
null=True)

postal_code = models.CharField(max_length=200, verbose_name='Kod 
pocztowy')

city = models.CharField(max_length=200, verbose_name='Miasto')

region = models.CharField(max_length=200, verbose_name='Województwo')

content_type = models.ForeignKey(ContentType,verbose_name='Rodzaj 
modelu', related_name="content_type_%(class)s",)

object_id = models.PositiveIntegerField(verbose_name='Rodzaj obiekt', 
db_index=True)

content_object = generic.GenericForeignKey('content_type', 'object_id')



class Partners(AbstractBaseUser, PermissionsMixin):

"""

Użytkownik

"""

login = models.CharField(max_length=200, verbose_name='Login', 
help_text=_('Required. 30 characters or fewer. Letters, numbers and 
@/./+/-/_ characters'), unique=True, db_index=True)

company = models.BooleanField(verbose_name='Firma/Prywatny')

company_name = models.CharField(max_length=200, verbose_name='Nazwa 
firmy', blank=True, null=True)

www = models.URLField(verbose_name='Strona internetowa', blank=True, 
null=True)

name = models.CharField(max_length=200, verbose_name='Imię', blank=True, 
null=True)

surname = models.CharField(max_length=200, verbose_name='Nazwisko', 
blank=True, null=True)

phone = models.CharField(max_length=200, verbose_name='Telefon', blank=
True, null=True)

email = models.EmailField(verbose_name='Email', blank=True, null=True)

regulations = models.BooleanField(verbose_name='Regulamin', default=True
)

date_of_birth = models.DateField(verbose_name='Data urodzenia', blank=
True, null=True)

is_staff = models.BooleanField(_('staff status'), default=True, 
help_text=_('Designates whether the user can log into this admin site.'))

is_active = models.BooleanField(_('active'), default=True, 
help_text=_('Designates 
whether this user should be treated as active. Unselect this instead of 
deleting accounts.'))

date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)



objects = PartnersManager()


USERNAME_FIELD = 'login'

REQUIRED_FIELDS = []


def get_full_name(self):

return '%s %s' % (self.name, self.surname)


def get_short_name(self):

return self.login


def __unicode__(self):

return self.login


class Meta:

verbose_name = "Użytkownik"

verbose_name_plural = "Użytkownicy"

ordering = ['id']

get_latest_by = "id"



#admim.py:

from django.contrib.auth.admin import UserAdmin

from core.forms import PartnersChangeForm, PartnersCreationForm

#etc...


class AddressAdminInline(generic.GenericStackedInline):

model = Addresses

ct_field = "content_type"

ct_fk_field = "object_id"

extra = 1

max_num = 1



class PartnersAdmin(UserAdmin):

form = PartnersChangeForm

add_form = PartnersCreationForm

list_display = ('login', 'name', 'surname', 'is_superuser')

list_filter = ('is_superuser',)

save_on_top = True

inlines = [

AddressAdminInline

]

fieldsets = (

(None, {

'fields': ('login', 'password')

}),

('Personal info', {

'fields': ('email', 'www', 'date_of_birth')

}),

('Personal info 2', {

'fields': ('company','company_name', 'name', 'surname', 'phone', 
'regulations' )

}),

('Permissions', {

'fields': ('is_superuser', 'is_staff', 'is_active', 'groups', 
'user_permissions')

}),

('Important dates', {

'fields': ('last_login',)

}),

)

add_fieldsets = (

(None, {

'classes': ('wide',),

'fields': ('login', 'password1', 'password2')}

),

)

search_fields = ('login',)

ordering = ('login',)

filter_horizontal = ('groups', 'user_permissions')


admin.site.register(Partners, PartnersAdmin)

admin.site.register(Addresses)


when run server used"./manage.py runserver" and go to User in 
DjangoAdminPanel i show:

Exception at /admin/core/partners/1/

 has more than 1 ForeignKey to 

Request Method:GETRequest 
URL:http://localhost:8000/admin/core/partners/1/Django 
Version:1.5c2Exception Type:ExceptionException Value:

 has more than 1 ForeignKey to 

Exception Location:/Library/Python/2.7/site-packages/django/forms/models.py 
in _get_foreign_key, line 825Python Executable:/usr/bin/pythonPython

pin matching query does not exist

2013-02-27 Thread okorie Emmanuel
hi

Am designing a form from django model, i have store some information in the 
database already, each time i enter a correct values am redirected to 
another page,but when ever an empty field is submitted it crash with this 
message " pin matching query does not exist" also when wrong query is 
entered (that is queries not in the database  ) the same thing happens that 
is" pin matching query does not exist" . I think validation is the problem 
but i don't know how to go about it. here is my code   

*form.py*

from django import forms
from you.models import Pin
from django.forms import ModelForm

class PinForm(forms.ModelForm):

class Meta:
#pin = forms.CharField(max_length=12, widget=forms.PasswordInput())
model = Pin
fields = ('serial_no','pin')
#exclude = ('is_active',)
widgets = {'pin': forms.PasswordInput(render_value=False),}
def clean(self):
from django.core.exceptions import ValidationError
if self.pin != pin  and self.serial_no != serial_no:
raise ValidationError('pin does not exist')
if self.pin == pin and self.serial_no and self.is_active == 
False:
raise ValidationError('pin has being used')
if self.pin == ""  and self.serial_no == "":
raise ValidationError('pin and serial no field cannot be 
empty')


*model.py*

from django.db import models
from django.forms import ModelForm
from django.core.exceptions import ValidationError


class Pin(models.Model):
pin = models.CharField(max_length=12)
serial_no = models.CharField(max_length=12)
is_active = models.BooleanField(default=True)

class Meta:
db_table = 'db_Pin'
ordering = ['pin']
def __unicode__(self):
return self.pin


*views.py*

from you.forms import PinForm  
from django.contrib.auth import authenticate, login, REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.conf import settings
from you.models import Pin
from django import forms
from django.core.exceptions import ValidationError


def index(request, template_name="index.html"):
ValidationError=[]
if request.method == "POST":
postdata = request.POST.copy()
form = PinForm(postdata)
if form.is_valid():
pin = request.POST.get('pin', '')
serial_no = request.POST.get('serial_no', '')
#decline = Pin.objects.get(pin=pin, serial_no=serial_no, 
is_active=False)
accept = Pin.objects.get(pin=pin, serial_no=serial_no, 
is_active=True)
if accept is not None and accept.is_active:
return HttpResponseRedirect('/acceptance/')

else:
form = PinForm()
return 
render_to_response('index.html',{'ValidationError':ValidationError, 
'form':form},context_instance=RequestContext(request) )
  



def acceptance(request, template_name = "acceptance.html"):
return render_to_response(template_name, locals(),context_instance = 
RequestContext(request))



*Template index.html*

{% extends 'base.html'%}

{% block site_wrapper %}
Register
{% if errors %}

{% for ValidationError in ValidationError %}
{{ ValidationError }}
{% endfor %}

{% endif %}

{% csrf_token %}
  

 {{ form.as_table }}
 
 
 
 

 
 
 
  
  



{% endblock %}



pls how can i validate this model form so that when an empty form is send 
it will display "can't submit empty form  to the user", when wrong query is 
entered it will display to the user "pin and serial number does not exist" 
and if the right query is entered and the is_active is false it should tell 
the user "pin used ", this is because i intend to deactivate a pin and 
serial number when a user registers successfully. 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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread Mário Antunes
Congratulations!

On Tuesday, February 26, 2013 7:44:27 PM UTC, James Bennett wrote:
>
> Yup, it's finally here! 
>
> * Announcement blog post here: 
> https://www.djangoproject.com/weblog/2013/feb/26/15/ 
> * Release notes here: https://docs.djangoproject.com/en/1.5/releases/1.5/ 
> * Download it here: https://www.djangoproject.com/download/ 
>

-- 
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: Begginer

2013-02-27 Thread abhijeet shete
Hi Akshay,

Django's online documentation is very good.
Here is the link for documentation. https://docs.djangoproject.com/en/1.4/



On Wed, Feb 27, 2013 at 1:59 PM, Akshay Ramesh wrote:

> Hi I am new to Djnago and would like to have some help from you. Where
> should I start from ?
>


Cheers.

-- 
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: Begginer

2013-02-27 Thread Roberto López López


Try https://docs.djangoproject.com/en/1.5/intro/



On 02/27/2013 09:29 AM, Akshay Ramesh wrote:
> Hi I am new to Djnago and would like to have some help from you. Where
> should I start from ?
> 

-- 
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: Begginer

2013-02-27 Thread Akshay Ramesh
Thank you Abhijeet :)

On Wed, Feb 27, 2013 at 6:00 PM, abhijeet shete
wrote:

> Hi Akshay,
>
> Django's online documentation is very good.
> Here is the link for documentation. https://docs.djangoproject.com/en/1.4/
>
>
>
> On Wed, Feb 27, 2013 at 1:59 PM, Akshay Ramesh 
> wrote:
>
>> Hi I am new to Djnago and would like to have some help from you. Where
>> should I start from ?
>>
>
>
> Cheers.
>
> --
> 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.
>
>
>



-- 
Regards,
Akshay R

-- 
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: pin matching query does not exist

2013-02-27 Thread Bill Freeman
A good place to start would be to fix the fact that, if the form is not
valid on a post, the view returns None.

Bill

On Wed, Feb 27, 2013 at 4:53 AM, okorie Emmanuel wrote:

> hi
>
> Am designing a form from django model, i have store some information in
> the database already, each time i enter a correct values am redirected to
> another page,but when ever an empty field is submitted it crash with this
> message " pin matching query does not exist" also when wrong query is
> entered (that is queries not in the database  ) the same thing happens that
> is" pin matching query does not exist" . I think validation is the problem
> but i don't know how to go about it. here is my code
>
> *form.py*
>
> from django import forms
> from you.models import Pin
> from django.forms import ModelForm
>
> class PinForm(forms.ModelForm):
>
> class Meta:
> #pin = forms.CharField(max_length=12, widget=forms.PasswordInput())
> model = Pin
> fields = ('serial_no','pin')
> #exclude = ('is_active',)
> widgets = {'pin': forms.PasswordInput(render_value=False),}
> def clean(self):
> from django.core.exceptions import ValidationError
> if self.pin != pin  and self.serial_no != serial_no:
> raise ValidationError('pin does not exist')
> if self.pin == pin and self.serial_no and self.is_active ==
> False:
> raise ValidationError('pin has being used')
> if self.pin == ""  and self.serial_no == "":
> raise ValidationError('pin and serial no field cannot be
> empty')
>
>
> *model.py*
>
> from django.db import models
> from django.forms import ModelForm
> from django.core.exceptions import ValidationError
>
>
> class Pin(models.Model):
> pin = models.CharField(max_length=12)
> serial_no = models.CharField(max_length=12)
> is_active = models.BooleanField(default=True)
>
> class Meta:
> db_table = 'db_Pin'
> ordering = ['pin']
> def __unicode__(self):
> return self.pin
>
>
> *views.py*
>
> from you.forms import PinForm
> from django.contrib.auth import authenticate, login, REDIRECT_FIELD_NAME
> from django.http import HttpResponseRedirect, HttpResponse
> from django.template import RequestContext
> from django.shortcuts import render_to_response
> from django.conf import settings
> from you.models import Pin
> from django import forms
> from django.core.exceptions import ValidationError
>
>
> def index(request, template_name="index.html"):
> ValidationError=[]
> if request.method == "POST":
> postdata = request.POST.copy()
> form = PinForm(postdata)
> if form.is_valid():
> pin = request.POST.get('pin', '')
> serial_no = request.POST.get('serial_no', '')
> #decline = Pin.objects.get(pin=pin, serial_no=serial_no,
> is_active=False)
> accept = Pin.objects.get(pin=pin, serial_no=serial_no,
> is_active=True)
> if accept is not None and accept.is_active:
> return HttpResponseRedirect('/acceptance/')
>
> else:
> form = PinForm()
> return
> render_to_response('index.html',{'ValidationError':ValidationError,
> 'form':form},context_instance=RequestContext(request) )
>
>
>
>
> def acceptance(request, template_name = "acceptance.html"):
> return render_to_response(template_name, locals(),context_instance =
> RequestContext(request))
>
>
>
> *Template index.html*
>
> {% extends 'base.html'%}
>
> {% block site_wrapper %}
> Register
> {% if errors %}
> 
> {% for ValidationError in ValidationError %}
> {{ ValidationError }}
> {% endfor %}
> 
> {% endif %}
>
> {% csrf_token %}
>
> 
>  {{ form.as_table }}
> 
> 
> 
> 
>
> 
> 
> 
> 
>
> 
>
>
> {% endblock %}
>
>
>
> pls how can i validate this model form so that when an empty form is send
> it will display "can't submit empty form  to the user", when wrong query is
> entered it will display to the user "pin and serial number does not exist"
> and if the right query is entered and the is_active is false it should tell
> the user "pin used ", this is because i intend to deactivate a pin and
> serial number when a user registers successfully. 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 unsubscrib

Redirect and execute after 2 seconds?

2013-02-27 Thread Maria
Hi everyone! :)
 
I am working on a project for my studies, it is a web poll where you can 
only answer yes or no by clicking on buttons.
 
If the user clicked on one button, the result will be saved in a text-file 
and the user will be redirected to another page with a random id:
 

> return HttpResponseRedirect ('/polls/'+str(sid))

 
*If the user doesnt click on any button quickly enough, I want the page to 
redirect them after 3 seconds to another page with a random id AND i want 
to save the id of the question that wasnt answered.*  How can I do it? I 
searched the web but only found the time.sleep function. As far as I 
understood, I cant use the sleep function because the site has to do other 
stuff while the 3 seconds pass.
 
I would be very thankful for any help on this!
 
Kind regards,
 
Maria

-- 
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: Redirect and execute after 2 seconds?

2013-02-27 Thread Bill Freeman
You must do this using JavaScript in the user's browser.  Look for time
based events in JavaScript, including how to cancel them if a button is
pressed.  The button should still probably submit to the Django server for
recording, but you could simply record the fact that the correct
(pseudo-)random id was visited.  You will have to record the GET for the
time out case.  The time out handler can simple write to window.location to
accomplish the "redirect" (which isn't really a redirect in the strict
sense, since it doesn't occur as part of fetching a different page).  And
that's JavaScript on the browser writing window.location, NOT anything
within Django.

Bill

On Wed, Feb 27, 2013 at 9:01 AM, Maria  wrote:

> Hi everyone! :)
>
> I am working on a project for my studies, it is a web poll where you can
> only answer yes or no by clicking on buttons.
>
> If the user clicked on one button, the result will be saved in a text-file
> and the user will be redirected to another page with a random id:
>
>
>> return HttpResponseRedirect ('/polls/'+str(sid))
>
>
> *If the user doesnt click on any button quickly enough, I want the page
> to redirect them after 3 seconds to another page with a random id AND i
> want to save the id of the question that wasnt answered.*  How can I do
> it? I searched the web but only found the time.sleep function. As far as I
> understood, I cant use the sleep function because the site has to do other
> stuff while the 3 seconds pass.
>
> I would be very thankful for any help on this!
>
> Kind regards,
>
> Maria
>
> --
> 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: Redirect and execute after 2 seconds?

2013-02-27 Thread Maria
Thank you Bill! I dont know if I got you but if I do it with JavaScript I 
can't save the ID of the "missed" page, can I?
Because I want to save the page where no button was clicked to show it 
again at the end of the poll, so that the user gets another chance to 
answer this question.
 

Am Mittwoch, 27. Februar 2013 15:26:37 UTC+1 schrieb ke1g:

> You must do this using JavaScript in the user's browser.  Look for time 
> based events in JavaScript, including how to cancel them if a button is 
> pressed.  The button should still probably submit to the Django server for 
> recording, but you could simply record the fact that the correct 
> (pseudo-)random id was visited.  You will have to record the GET for the 
> time out case.  The time out handler can simple write to window.location to 
> accomplish the "redirect" (which isn't really a redirect in the strict 
> sense, since it doesn't occur as part of fetching a different page).  And 
> that's JavaScript on the browser writing window.location, NOT anything 
> within Django.
>
> Bill
>
> On Wed, Feb 27, 2013 at 9:01 AM, Maria >wrote:
>
>> Hi everyone! :)
>>  
>> I am working on a project for my studies, it is a web poll where you can 
>> only answer yes or no by clicking on buttons.
>>  
>> If the user clicked on one button, the result will be saved in a 
>> text-file and the user will be redirected to another page with a random id:
>>  
>>
>>> return HttpResponseRedirect ('/polls/'+str(sid))
>>
>>  
>> *If the user doesnt click on any button quickly enough, I want the page 
>> to redirect them after 3 seconds to another page with a random id AND i 
>> want to save the id of the question that wasnt answered.*  How can I do 
>> it? I searched the web but only found the time.sleep function. As far as I 
>> understood, I cant use the sleep function because the site has to do other 
>> stuff while the 3 seconds pass.
>>  
>> I would be very thankful for any help on this!
>>  
>> Kind regards,
>>  
>> Maria
>>
>> -- 
>> 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: Redirect and execute after 2 seconds?

2013-02-27 Thread Alan Plum

Hi Maria,

as Bill explained, you should be looking at JavaScript for everything 
that happens on the client-side (i.e. after the page has left the server).


However you should consider shifting more of the logic to the 
client-side in this case. For time-based actions with such a short 
duration the additional overhead involved in sending and receiving a web 
page could affect the results quite dramatically, especially when the 
user is on a dodgy connection (think mobile or dial-up).


You may want to look into learning AJAX to communicate between the 
client and server without requiring a full page reload and into a 
front-end library like jQuery for adding the necessary client-side logic 
to hide and reveal elements on the page (i.e. client-side) or provide 
dynamic updates after the page has been sent by the server (Django).


There are some good live coding exercises and screencasts available 
online if you want to learn more about jQuery or other front-end 
libraries or just JavaScript in general.



Yours,

Alan

On 27.02.2013 15:01, Maria wrote:

Hi everyone! :)
I am working on a project for my studies, it is a web poll where you 
can only answer yes or no by clicking on buttons.
If the user clicked on one button, the result will be saved in a 
text-file and the user will be redirected to another page with a 
random id:


return HttpResponseRedirect ('/polls/'+str(sid))

*If the user doesnt click on any button quickly enough, I want the 
page to redirect them after 3 seconds to another page with a random id 
AND i want to save the id of the question that wasnt answered.*  How 
can I do it? I searched the web but only found the time.sleep 
function. As far as I understood, I cant use the sleep function 
because the site has to do other stuff while the 3 seconds pass.

I would be very thankful for any help on this!
Kind regards,
Maria
--
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: Redirect and execute after 2 seconds?

2013-02-27 Thread Maria
*like this:*
if user clicks button
  save answer
  return HttpResponseRedirect ('/polls/'+str(sid))
else *after 3 seconds*
  save this page for later
  return HttpResponseRedirect ('/polls/'+str(sid))

-- 
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: Redirect and execute after 2 seconds?

2013-02-27 Thread Maria
Hello Alan,
 
I'd love to learn something new but unfortunately I dont have the time 
since my project is due very soon. Is there no easy or short way to get 
this time variable into my code? Also, how do I "look for everything that 
happens on the client-side"? I am sorry for my incompetence.. :D
 

Am Mittwoch, 27. Februar 2013 16:06:05 UTC+1 schrieb Alan Plum:

>  Hi Maria,
>
> as Bill explained, you should be looking at JavaScript for everything that 
> happens on the client-side (i.e. after the page has left the server).
>
> However you should consider shifting more of the logic to the client-side 
> in this case. For time-based actions with such a short duration the 
> additional overhead involved in sending and receiving a web page could 
> affect the results quite dramatically, especially when the user is on a 
> dodgy connection (think mobile or dial-up).
>
> You may want to look into learning AJAX to communicate between the client 
> and server without requiring a full page reload and into a front-end 
> library like jQuery for adding the necessary client-side logic to hide and 
> reveal elements on the page (i.e. client-side) or provide dynamic updates 
> after the page has been sent by the server (Django).
>
> There are some good live coding exercises and screencasts available online 
> if you want to learn more about jQuery or other front-end libraries or just 
> JavaScript in general.
>
>
> Yours,
>
> Alan
>
> On 27.02.2013 15:01, Maria wrote:
>  
> Hi everyone! :)
>  
> I am working on a project for my studies, it is a web poll where you can 
> only answer yes or no by clicking on buttons.
>  
> If the user clicked on one button, the result will be saved in a text-file 
> and the user will be redirected to another page with a random id:
>  
>
>> return HttpResponseRedirect ('/polls/'+str(sid))
>
>  
> *If the user doesnt click on any button quickly enough, I want the page 
> to redirect them after 3 seconds to another page with a random id AND i 
> want to save the id of the question that wasnt answered.*  How can I do 
> it? I searched the web but only found the time.sleep function. As far as I 
> understood, I cant use the sleep function because the site has to do other 
> stuff while the 3 seconds pass.
>  
> I would be very thankful for any help on this!
>  
> Kind regards,
>  
> Maria
> -- 
> 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: Redirect and execute after 2 seconds?

2013-02-27 Thread Roberto López López

Maria, that code (your "after three seconds") has to be run on the
client, so django has nothing to do with it. As Bill suggests, you
should try some javascript here.



On 02/27/2013 04:10 PM, Maria wrote:
> _like this:_
> if user clicks button
>   save answer
>   return HttpResponseRedirect ('/polls/'+str(sid))
> else *after 3 seconds*
>   save this page for later
>   return HttpResponseRedirect ('/polls/'+str(sid))
> 
> -- 
> 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.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
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.




password encryption

2013-02-27 Thread Tomas Neme
I just ran into this. It presses a pretty strong case...

http://codahale.com/how-to-safely-store-a-password/

--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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: password encryption

2013-02-27 Thread Tomas Neme
and here it presses an even stronger case about NOT using bcrypt but
something even slower

http://www.unlimitednovelty.com/2012/03/dont-use-bcrypt.html

On Wed, Feb 27, 2013 at 12:33 PM, Tomas Neme  wrote:
> I just ran into this. It presses a pretty strong case...
>
> http://codahale.com/how-to-safely-store-a-password/
>
> --
> "The whole of Japan is pure invention. There is no such country, there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.



--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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: Redirect and execute after 2 seconds?

2013-02-27 Thread Bill Freeman
Maria,

If the id is truely unique (is never used again for another version of the
poll), then the fact that the browser visits the URL containing the ID
gives you a chance to note the missed question.

Separately, you may want to look into Django's session stuff, since you
then need not encode answer/non-answer IDs into the URL.  The session
cookie associates a particular set of session data with requests from this
browser.  Then all poll takers can share the same set of URLs, which might
be unique to a question, or could be generic, with which question is
currently being answered or missed stored on the session.  You might, in
fact, use the same URL for everything, making the buttons submit buttons of
a form, where which submit button is pressed is encoded in the query
parameters, and the timeout submits to a hard coded URL that is either
recognizable because it doesn't have that query parameter, or has the
equivalent of a "timed out" or "skip" button hard coded in its query
parameters.  Either way, using the session saves you from having to
generate and match upon your "random" IDs.

Bill

On Wed, Feb 27, 2013 at 10:01 AM, Maria  wrote:

> Thank you Bill! I dont know if I got you but if I do it with JavaScript I
> can't save the ID of the "missed" page, can I?
> Because I want to save the page where no button was clicked to show it
> again at the end of the poll, so that the user gets another chance to
> answer this question.
>
>
> Am Mittwoch, 27. Februar 2013 15:26:37 UTC+1 schrieb ke1g:
>
>> You must do this using JavaScript in the user's browser.  Look for time
>> based events in JavaScript, including how to cancel them if a button is
>> pressed.  The button should still probably submit to the Django server for
>> recording, but you could simply record the fact that the correct
>> (pseudo-)random id was visited.  You will have to record the GET for the
>> time out case.  The time out handler can simple write to window.location to
>> accomplish the "redirect" (which isn't really a redirect in the strict
>> sense, since it doesn't occur as part of fetching a different page).  And
>> that's JavaScript on the browser writing window.location, NOT anything
>> within Django.
>>
>> Bill
>>
>> On Wed, Feb 27, 2013 at 9:01 AM, Maria  wrote:
>>
>>> Hi everyone! :)
>>>
>>> I am working on a project for my studies, it is a web poll where you can
>>> only answer yes or no by clicking on buttons.
>>>
>>> If the user clicked on one button, the result will be saved in a
>>> text-file and the user will be redirected to another page with a random id:
>>>
>>>
 return HttpResponseRedirect ('/polls/'+str(sid))
>>>
>>>
>>> *If the user doesnt click on any button quickly enough, I want the page
>>> to redirect them after 3 seconds to another page with a random id AND i
>>> want to save the id of the question that wasnt answered.*  How can I do
>>> it? I searched the web but only found the time.sleep function. As far as I
>>> understood, I cant use the sleep function because the site has to do other
>>> stuff while the 3 seconds pass.
>>>
>>> I would be very thankful for any help on this!
>>>
>>> Kind regards,
>>>
>>> Maria
>>>
>>> --
>>> 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: Redirect and execute after 2 seconds?

2013-02-27 Thread Roberto López López

Hi again Maria,

Try to combine the solutions proposed in those two pages:

http://stackoverflow.com/questions/2133166/loop-timer-in-javascript#2133217
http://stackoverflow.com/questions/948227/should-i-use-window-navigate-or-document-location-in-javascript#948242

That should be more than enough.

Roberto



On 02/27/2013 04:19 PM, Maria wrote:
> Hello Alan,
>  
> I'd love to learn something new but unfortunately I dont have the time
> since my project is due very soon. Is there no easy or short way to get
> this time variable into my code? Also, how do I "look for everything
> that happens on the client-side"? I am sorry for my incompetence.. :D
>  
> 
> Am Mittwoch, 27. Februar 2013 16:06:05 UTC+1 schrieb Alan Plum:
> 
> Hi Maria,
> 
> as Bill explained, you should be looking at JavaScript for
> everything that happens on the client-side (i.e. after the page has
> left the server).
> 
> However you should consider shifting more of the logic to the
> client-side in this case. For time-based actions with such a short
> duration the additional overhead involved in sending and receiving a
> web page could affect the results quite dramatically, especially
> when the user is on a dodgy connection (think mobile or dial-up).
> 
> You may want to look into learning AJAX to communicate between the
> client and server without requiring a full page reload and into a
> front-end library like jQuery for adding the necessary client-side
> logic to hide and reveal elements on the page (i.e. client-side) or
> provide dynamic updates after the page has been sent by the server
> (Django).
> 
> There are some good live coding exercises and screencasts available
> online if you want to learn more about jQuery or other front-end
> libraries or just JavaScript in general.
> 
> 
> Yours,
> 
> Alan
> 
> On 27.02.2013 15:01, Maria wrote:
>> Hi everyone! :)
>>  
>> I am working on a project for my studies, it is a web poll where
>> you can only answer yes or no by clicking on buttons.
>>  
>> If the user clicked on one button, the result will be saved in a
>> text-file and the user will be redirected to another page with a
>> random id:
>>  
>>
>> return HttpResponseRedirect ('/polls/'+str(sid))
>>
>>  
>> *If the user doesnt click on any button quickly enough, I want the
>> page to redirect them after 3 seconds to another page with a
>> random id AND i want to save the id of the question that wasnt
>> answered.*  How can I do it? I searched the web but only found the
>> time.sleep function. As far as I understood, I cant use the sleep
>> function because the site has to do other stuff while the 3
>> seconds pass.
>>  
>> I would be very thankful for any help on this!
>>  
>> Kind regards,
>>  
>> Maria
>> -- 
>> 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.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
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: Redirect and execute after 2 seconds?

2013-02-27 Thread Maria
Unfortunately, the ID is not unique, as every ID will be used 3 times in 
each session. Is it still possible to use JavaScript as a solution?

Am Mittwoch, 27. Februar 2013 16:44:45 UTC+1 schrieb ke1g:

> Maria,
>
> If the id is truely unique (is never used again for another version of the 
> poll), then the fact that the browser visits the URL containing the ID 
> gives you a chance to note the missed question.
>
> Separately, you may want to look into Django's session stuff, since you 
> then need not encode answer/non-answer IDs into the URL.  The session 
> cookie associates a particular set of session data with requests from this 
> browser.  Then all poll takers can share the same set of URLs, which might 
> be unique to a question, or could be generic, with which question is 
> currently being answered or missed stored on the session.  You might, in 
> fact, use the same URL for everything, making the buttons submit buttons of 
> a form, where which submit button is pressed is encoded in the query 
> parameters, and the timeout submits to a hard coded URL that is either 
> recognizable because it doesn't have that query parameter, or has the 
> equivalent of a "timed out" or "skip" button hard coded in its query 
> parameters.  Either way, using the session saves you from having to 
> generate and match upon your "random" IDs.
>
> Bill
>
> On Wed, Feb 27, 2013 at 10:01 AM, Maria >wrote:
>
>> Thank you Bill! I dont know if I got you but if I do it with JavaScript I 
>> can't save the ID of the "missed" page, can I?
>> Because I want to save the page where no button was clicked to show it 
>> again at the end of the poll, so that the user gets another chance to 
>> answer this question.
>>  
>>
>> Am Mittwoch, 27. Februar 2013 15:26:37 UTC+1 schrieb ke1g:
>>
>>> You must do this using JavaScript in the user's browser.  Look for time 
>>> based events in JavaScript, including how to cancel them if a button is 
>>> pressed.  The button should still probably submit to the Django server for 
>>> recording, but you could simply record the fact that the correct 
>>> (pseudo-)random id was visited.  You will have to record the GET for the 
>>> time out case.  The time out handler can simple write to window.location to 
>>> accomplish the "redirect" (which isn't really a redirect in the strict 
>>> sense, since it doesn't occur as part of fetching a different page).  And 
>>> that's JavaScript on the browser writing window.location, NOT anything 
>>> within Django.
>>>
>>> Bill
>>>
>>> On Wed, Feb 27, 2013 at 9:01 AM, Maria  wrote:
>>>
  Hi everyone! :)
  
 I am working on a project for my studies, it is a web poll where you 
 can only answer yes or no by clicking on buttons.
  
 If the user clicked on one button, the result will be saved in a 
 text-file and the user will be redirected to another page with a random id:
  

> return HttpResponseRedirect ('/polls/'+str(sid))

  
 *If the user doesnt click on any button quickly enough, I want the 
 page to redirect them after 3 seconds to another page with a random id AND 
 i want to save the id of the question that wasnt answered.*  How can I 
 do it? I searched the web but only found the time.sleep function. As far 
 as 
 I understood, I cant use the sleep function because the site has to do 
 other stuff while the 3 seconds pass.
  
 I would be very thankful for any help on this!
  
 Kind regards,
  
 Maria

 -- 
 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...@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 htt

Re: Redirect and execute after 2 seconds?

2013-02-27 Thread Bill Freeman
Yes.  Tie it to the session.

Is the need for random IDs an attempt to keep users from figuring out how
to re-answer questions by composing URLs themselves?  Just record which
questions they have answered, and ignore attempts to answer them again.
Or are random IDs some PHB's beloved mechanism that you are stuck with?

Bill

On Wed, Feb 27, 2013 at 11:00 AM, Maria  wrote:

> Unfortunately, the ID is not unique, as every ID will be used 3 times in
> each session. Is it still possible to use JavaScript as a solution?
>
> Am Mittwoch, 27. Februar 2013 16:44:45 UTC+1 schrieb ke1g:
>
>> Maria,
>>
>> If the id is truely unique (is never used again for another version of
>> the poll), then the fact that the browser visits the URL containing the ID
>> gives you a chance to note the missed question.
>>
>> Separately, you may want to look into Django's session stuff, since you
>> then need not encode answer/non-answer IDs into the URL.  The session
>> cookie associates a particular set of session data with requests from this
>> browser.  Then all poll takers can share the same set of URLs, which might
>> be unique to a question, or could be generic, with which question is
>> currently being answered or missed stored on the session.  You might, in
>> fact, use the same URL for everything, making the buttons submit buttons of
>> a form, where which submit button is pressed is encoded in the query
>> parameters, and the timeout submits to a hard coded URL that is either
>> recognizable because it doesn't have that query parameter, or has the
>> equivalent of a "timed out" or "skip" button hard coded in its query
>> parameters.  Either way, using the session saves you from having to
>> generate and match upon your "random" IDs.
>>
>> Bill
>>
>> On Wed, Feb 27, 2013 at 10:01 AM, Maria  wrote:
>>
>>> Thank you Bill! I dont know if I got you but if I do it with JavaScript
>>> I can't save the ID of the "missed" page, can I?
>>> Because I want to save the page where no button was clicked to show it
>>> again at the end of the poll, so that the user gets another chance to
>>> answer this question.
>>>
>>>
>>> Am Mittwoch, 27. Februar 2013 15:26:37 UTC+1 schrieb ke1g:
>>>
 You must do this using JavaScript in the user's browser.  Look for time
 based events in JavaScript, including how to cancel them if a button is
 pressed.  The button should still probably submit to the Django server for
 recording, but you could simply record the fact that the correct
 (pseudo-)random id was visited.  You will have to record the GET for the
 time out case.  The time out handler can simple write to window.location to
 accomplish the "redirect" (which isn't really a redirect in the strict
 sense, since it doesn't occur as part of fetching a different page).  And
 that's JavaScript on the browser writing window.location, NOT anything
 within Django.

 Bill

 On Wed, Feb 27, 2013 at 9:01 AM, Maria  wrote:

>  Hi everyone! :)
>
> I am working on a project for my studies, it is a web poll where you
> can only answer yes or no by clicking on buttons.
>
> If the user clicked on one button, the result will be saved in a
> text-file and the user will be redirected to another page with a random 
> id:
>
>
>> return HttpResponseRedirect ('/polls/'+str(sid))
>
>
> *If the user doesnt click on any button quickly enough, I want the
> page to redirect them after 3 seconds to another page with a random id AND
> i want to save the id of the question that wasnt answered.*  How can
> I do it? I searched the web but only found the time.sleep function. As far
> as I understood, I cant use the sleep function because the site has to do
> other stuff while the 3 seconds pass.
>
> I would be very thankful for any help on this!
>
> Kind regards,
>
> Maria
>
> --
> 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/**grou**ps/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...@**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

I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-27 Thread Mark London
I need a widget or a method that allows users to select items from a list 
of choices, or add a new choice.   Someone on stackoverflow asked the same 
question, and got a kludgy answer:

http://stackoverflow.com/questions/14802167/how-do-i-make-a-django-choicefield-accept-both-preset-choices-and-the-addition-

There should be a better way than this.  Thanks.

- Mark 

-- 
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: I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-27 Thread Shawn Milochik
Remember, it's just Python. In the end, all you need is for the
'choices' of the field (which is just an iterable) to contain the
value after the form's __init__ so that the form won't consider the
value invalid.

You could:

1. Have a pop-up form that allows the user to submit the new choice
via AJAX, then use JavaScript to update the dropdown.

2. Have a text box which they can fill in and leave the drop-down
blank, then take the appropriate actions in the view.

3. Whatever else works.

As always, beware of user input. But it's not a hard problem to solve.
It's a bit easier if the choices come from a model, so you can just
add new instances to that model as users add them so they're retained
for other visitors.

-- 
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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread victoria
On Tue, Feb 26, 2013 at 8:44 PM, James Bennett  wrote:
> Yup, it's finally here!
>
> * Announcement blog post here:
> https://www.djangoproject.com/weblog/2013/feb/26/15/
> * Release notes here: https://docs.djangoproject.com/en/1.5/releases/1.5/
> * Download it here: https://www.djangoproject.com/download/
>

Django 1.5 version is also already available as a BitNami Stack.
Installers and virtual machines can already be downloaded, cloud
images for Windows Azure and for Amazon cloud will be ready soon.

http://bitnami.org/stack/django

Notice that BitNami DjangoStack already includes PostgreSQL and Posgis
2.0 (for the Linux and Mac versions) so you can easily test the
Geodjango support for Postgis 2.0 without fighting in setting the
right environment :)

> --
> 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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread Alioune Dia
Thank for good job you have done , we are Linux user group  and django-hacker
in Senegal and we are happy to see the new release of django with support
for python3 .Great work!
--Ad


2013/2/26 James Bennett :
> Yup, it's finally here!
>
> * Announcement blog post here:
> https://www.djangoproject.com/weblog/2013/feb/26/15/
> * Release notes here: https://docs.djangoproject.com/en/1.5/releases/1.5/
> * Download it here: https://www.djangoproject.com/download/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-develop...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers?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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread Shawn Milochik
Ahh, the release of a new version of Django. Always a fantastic time
to support the Django Software Foundation:

https://www.djangoproject.com/foundation/donate/

The money goes to support sprints and other things -- see the donate
page for more details.

-- 
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: Best practices for 1.5 configurable user model and profiles

2013-02-27 Thread Doug
Russ,

Thanks so much for your reply. I guess the confusion is around the 
subjectivity of what is considered "identifying the user". In my case, the 
additional data is not application related, it is project related and would 
be part of a "Profile" that is used throughout the site across many 
applications. 

I guess the more specific question would be: should user data be limited to 
data necessary for _authentication_. This makes sense when you take into 
account that the app it is a part of is "auth". 
So when you say "core identifying information", do you mean authentication 
information? In this case, avatar would not fit the description, in much 
the same way that bio or location would not. 

Perhaps I am overcomplicating things, but I want to create a solution that 
is as simple as possible without limiting flexibility. 

I guess what would help is an idea of what the primary reason was for the 
change to the user model in 1.5. Was it primarily to address the issue of 
an easier way to provide alternative authentication (versus writing a 
separate backend)? Or was it also to make it easier to create the concept 
of a "profile"?

On Saturday, February 23, 2013 11:15:20 PM UTC-5, Russell Keith-Magee wrote:
>
> Hi Doug,
>
> Obviously, it's still early days, so "best practice" hasn't really evolved 
> yet. However, based on what I've done with custom user models so far, my 
> advice would be to only put on the User model those things that are part of 
> identifying the User, and maintain a profile for any application-related 
> information that is user specific.
>
> So - things like a username, primary contact email address, and an avatar 
> would be reasonable things to have on the User model.
>
> Phone number *might* be appropriate for the User model -- depending on 
> whether a phone number is something that is core identifying information 
> for users of you project, or just additional profile information.
>
> Things like a biography or current location aren't key concepts for a user 
> -- they're something that can be isolated as part of a profile that is 
> contained in one or many separate user-related applications. 
>
> In many respects, this is exactly the same story that Django has always 
> maintained -- the difference is that now you have more control over exactly 
> what is considered "core" identifying information.
>
> Of course, there are exceptions to every rule -- and the one exception 
> that exists here is performance based. Using profile objects requires the 
> use of a join, and if you're doing a *lot* of profile joins, you might find 
> that denormalizing that join, and putting profile information on the base 
> user object may be worthwhile. 
>
> However, this should be considered a potential performance enhancement, 
> not architectural advice -- IMHO, most users won't be dealing with enough 
> query volume to be affected by this problem, and should be using profile 
> objects rather than denormalizing.
>
> Yours,
> Russ Magee %-)
>
> On Fri, Feb 22, 2013 at 11:10 PM, Doug >wrote:
>
>> I am curious how people are handling the new 1.5 user model with regard 
>> to User Profiles. Is it best to add all profile information to a custom 
>> user model? Or keep the user model for authentication information only and 
>> create a one-to-on or foreign key to a profile model (similar to the 
>> pre-1.5 best practice)?
>>
>> In my case, users will have an avatar, a bio, a location, and other 
>> profile type information.
>>
>> What are the pros and cons of each approach?
>>
>> -- 
>> 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: Best practices for 1.5 configurable user model and profiles

2013-02-27 Thread Shawn Milochik
Do a search on the history of the django-developers mailing list.
There are many reasons, and they were discussed for literally years.

Some of the main ones that come to mind:

first_name/last_name is US-centric.
e-mail address field length was too short.
e-mail address could not be used as the username

-- 
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.




StreamingHttpResponse into a Template

2013-02-27 Thread Stefano Tranquillini


Django 1.5 is just came out and it ships the StreamingHttpResponse. 

What i want to do is to print the output of a stream response into a 
template, having for example a bar that grows based on the streamed data 
(something similar to a loading bar).

so far i've found a solution that basically is to write the pieces of the 
final html page into the generator function, so each yield does a 
render_to_text of a piece of the final html page (i splitted it manually) 
putting each time the data just processed. 

The problem of this solution is that i can't have the loading bar. What I'm 
able to have are incremental data, so i can print out the list of processed 
data, but it's different to what i want to do.

Is there a way to do what i would like to do? 

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: StreamingHttpResponse into a Template

2013-02-27 Thread Masklinn
On 2013-02-27, at 18:23 , Stefano Tranquillini wrote:
> Django 1.5 is just came out and it ships the StreamingHttpResponse. 
> 
> What i want to do is to print the output of a stream response into a 
> template

I'm pretty sure that doesn't make sense: the template has to be
rendered, and I'm pretty sure a given Django template doesn't render to
a stream given https://code.djangoproject.com/ticket/13910 is still
open.

What you *can* do is work the other way around, create a
StreamingHttpResponse and fill it with multiple renderings of a template.

> , having for example a bar that grows based on the streamed data 
> (something similar to a loading bar).

If your render target is HTML, that doesn't make any sense either.
That's just not how HTML works. You might be able to send a CSS
stream with incremental rules overwriting one another and growing
a "loading bar", but that's abuse of the whole thing and not of
much use.

> so far i've found a solution that basically is to write the pieces of the 
> final html page into the generator function, so each yield does a 
> render_to_text of a piece of the final html page (i splitted it manually) 
> putting each time the data just processed. 
> 
> The problem of this solution is that i can't have the loading bar. What I'm 
> able to have are incremental data, so i can print out the list of processed 
> data, but it's different to what i want to do.
> 
> Is there a way to do what i would like to do? 

Think about it again and explain what you're originally trying to
achieve. You seem to be approaching the problem from the wrong
direction, as far as I can read.

-- 
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: Problem UserAdmin with GenericStackedInline in Django 1.5c2

2013-02-27 Thread carlos
Hi maybe you forget this

# Re-register UserAdminadmin.site.unregister(User)admin.site.register(User,
UserAdmin)

https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#extending-the-existing-user-model



On Wed, Feb 27, 2013 at 2:35 AM, Witold Greń  wrote:

> Hi, I have a problem UserAdmin with GenericStackedInline in Django 1.5c2.
>
> #model.py
>
> from django.contrib.auth.models import BaseUserManager, AbstractBaseUser,
> PermissionsMixin
>
> from django.conf import settings
>
> #etc...
>
>
> class Addresses(models.Model):
>
> """
>
> Dane adresowe.
>
> """
>
> name = models.CharField(max_length=200, verbose_name='Nazwa')
>
> street = models.CharField(max_length=200, verbose_name='Ulica')
>
> no_house = models.IntegerField(verbose_name='Numer budynku')
>
> no_local = models.IntegerField(verbose_name='Numer lokalu', blank=True,
> null=True)
>
> postal_code = models.CharField(max_length=200, verbose_name='Kod
> pocztowy')
>
> city = models.CharField(max_length=200, verbose_name='Miasto')
>
> region = models.CharField(max_length=200, verbose_name='Województwo')
>
> content_type = models.ForeignKey(ContentType,verbose_name='Rodzaj
> modelu', related_name="content_type_%(class)s",)
>
> object_id = models.PositiveIntegerField(verbose_name='Rodzaj obiekt',
> db_index=True)
>
> content_object = generic.GenericForeignKey('content_type', 'object_id'
> )
>
>
>
> class Partners(AbstractBaseUser, PermissionsMixin):
>
> """
>
> Użytkownik
>
> """
>
> login = models.CharField(max_length=200, verbose_name='Login',
> help_text=_('Required. 30 characters or fewer. Letters, numbers and
> @/./+/-/_ characters'), unique=True, db_index=True)
>
> company = models.BooleanField(verbose_name='Firma/Prywatny')
>
> company_name = models.CharField(max_length=200, verbose_name='Nazwa
> firmy', blank=True, null=True)
>
> www = models.URLField(verbose_name='Strona internetowa', blank=True,
> null=True)
>
> name = models.CharField(max_length=200, verbose_name='Imię', blank=
> True, null=True)
>
> surname = models.CharField(max_length=200, verbose_name='Nazwisko',
> blank=True, null=True)
>
> phone = models.CharField(max_length=200, verbose_name='Telefon',
> blank=True, null=True)
>
> email = models.EmailField(verbose_name='Email', blank=True, null=True)
>
> regulations = models.BooleanField(verbose_name='Regulamin', default=
> True)
>
> date_of_birth = models.DateField(verbose_name='Data urodzenia', blank=
> True, null=True)
>
> is_staff = models.BooleanField(_('staff status'), default=True,
> help_text=_('Designates whether the user can log into this admin site.'))
>
> is_active = models.BooleanField(_('active'), default=True,
> help_text=_('Designates whether this user should be treated as active.
> Unselect this instead of deleting accounts.'))
>
> date_joined = models.DateTimeField(_('date joined'), auto_now_add=True
> )
>
>
>
> objects = PartnersManager()
>
>
> USERNAME_FIELD = 'login'
>
> REQUIRED_FIELDS = []
>
>
> def get_full_name(self):
>
> return '%s %s' % (self.name, self.surname)
>
>
> def get_short_name(self):
>
> return self.login
>
>
> def __unicode__(self):
>
> return self.login
>
>
> class Meta:
>
> verbose_name = "Użytkownik"
>
> verbose_name_plural = "Użytkownicy"
>
> ordering = ['id']
>
> get_latest_by = "id"
>
>
>
> #admim.py:
>
> from django.contrib.auth.admin import UserAdmin
>
> from core.forms import PartnersChangeForm, PartnersCreationForm
>
> #etc...
>
>
> class AddressAdminInline(generic.GenericStackedInline):
>
> model = Addresses
>
> ct_field = "content_type"
>
> ct_fk_field = "object_id"
>
> extra = 1
>
> max_num = 1
>
>
>
> class PartnersAdmin(UserAdmin):
>
> form = PartnersChangeForm
>
> add_form = PartnersCreationForm
>
> list_display = ('login', 'name', 'surname', 'is_superuser')
>
> list_filter = ('is_superuser',)
>
> save_on_top = True
>
> inlines = [
>
> AddressAdminInline
>
> ]
>
> fieldsets = (
>
> (None, {
>
> 'fields': ('login', 'password')
>
> }),
>
> ('Personal info', {
>
> 'fields': ('email', 'www', 'date_of_birth')
>
> }),
>
> ('Personal info 2', {
>
> 'fields': ('company','company_name', 'name', 'surname',
> 'phone', 'regulations' )
>
> }),
>
> ('Permissions', {
>
> 'fields': ('is_superuser', 'is_staff', 'is_active', 'groups',
> 'user_permissions')
>
> }),
>
> ('Important dates', {
>
> 'fields': ('last_login',)
>
> }),
>
> )
>
> add_fieldsets = (
>
> (None, {
>
> 'classes': ('wide',),
>
> 'fields': ('login', 'password1', 'password2')}
>
> ),
>
> )
>
> search_fields = ('login',)
>
> ordering = ('login',)
>
> filter_horizontal 

Re: Best practices for 1.5 configurable user model and profiles

2013-02-27 Thread Doug
Thanks Shawn. So what is your take? Only authentication data in User? 
Separate Profile model and app? 

On Wednesday, February 27, 2013 12:07:55 PM UTC-5, Shawn Milochik wrote:
>
> Do a search on the history of the django-developers mailing list. 
> There are many reasons, and they were discussed for literally years. 
>
> Some of the main ones that come to mind: 
>
> first_name/last_name is US-centric. 
> e-mail address field length was too short. 
> e-mail address could not be used as the username 
>

-- 
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: Best practices for 1.5 configurable user model and profiles

2013-02-27 Thread Shawn Milochik
On Wed, Feb 27, 2013 at 12:46 PM, Doug  wrote:
> Thanks Shawn. So what is your take? Only authentication data in User?
> Separate Profile model and app?

I think Russell hit the main points well. Make User only what it needs
to be for identification/authentication, and put other stuff
elsewhere, unless it becomes a performance issue, in which case
selectively denormalize.

I don't know what weight my opinion carries, but I've been using
Django full-time for about four years, and I think if I made a custom
user model, it would just have e-mail (to be used for authentication),
password (mangled, of course), and the is_active flag. Anything else
is probably unnecessary for my uses, although maybe I could do with a
"name" field for a free-form name to display in logs or a greeting to
the user.

-- 
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: StreamingHttpResponse into a Template

2013-02-27 Thread Masklinn
On 2013-02-27, at 18:47 , Stefano Tranquillini wrote:

> Hi, thank you for the answer.
> basically what i've to do is to iterate the same operation for a bunch of
> user (e.g. send an email).
> i've around 200 users and each mail takes 2 seconds.
> so 400 seconds in total and the server goes in timeout. Have to wait 400
> seconds on a blank page is not really nice as well.
> 
> what i want to do is to stream out to a page an info that a new email was
> sent. This will avoid the timeout (i guess) and i can keep track of the
> job.

This kind of stuff is generally done asynchronously, dispatching the
sending to some sort of queue[0] to be executed either through a cronjob
or through a dedicated worker (*not* a WSGI/Django handler) waiting for
any mail to send.

Notifications, if any, are provided separately (e.g. by reloading a
"status" page every 10~15~30s or so; by using a javascript widget
polling the same kind of "status" endpoint or by using more "push"-y
async techniques). If you want notifications you probably want to use
a queue/worker system (rather than cronjobs) so they can get started
immediately and provide feedback. Something like Celery[2] for instance.

Sending email (or any other kind of very long operation) within the HTTP
request is pretty much always A Bad Idea: it ties up resources (e.g.
HTTP/WSGI workers, database transactions) better used serving requests
to users and tends to make the code more gnarly and less maintainable.

As far as I've seen anyway.

[0] For instance Pinax's Django Mailer[1] has an in-request part which
shoves mails to send in the DB, and a management command to execute via
e.g. a cronjob which does the actual sending
[1] https://github.com/pinax/django-mailer
[2] celeryproject.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.




1.5 custom user model: Add User with default UserCreationForm results in "no such table: auth_user"

2013-02-27 Thread Eric Psalmond
Hi everyone,

After a bit of searching I didn't find an answer to this issue, so I 
thought I'd post here and see what the response was like.

A little background:  I've been working with other frameworks and packages 
for years - from Websphere long ago to RoR and M$-MVC more recently.

After using Django for about two weeks I'm 100% in love with it and have 
been singing its praises from the mountaintops.  Documentation is dead on 
and unlike anything else I've seen, and the ORM is for people that actually 
understand and like RDBMS, and in a day and age of No-SQL fads and PHP 
"developers," it has been very refreshing.  I was trying out Django 
alongside with a trendy new PHP framework that claimed to have great docs 
and ORM, but when implementing it I found it was a typical mess of 
documentation-by-forum and uniquely seemed to love the smell of its own 
farts more than any open source project I'd ever seen.

If I had one complaint about Django, it would be lack of support for 
composite keys,  but I see enough work has already been done on that front 
that I might feel comfortable hacking something together, and it's so minor 
compared to all the other benefits that I can live with it.

Anyway- on to my question:

I rolled a custom user model since 1.5 was released yesterday.  I love the 
abstractions of AbstractUser and AbstractBaseUser, it totally makes sense. 
 However, when I rolled my own custom user class and tried to use the built 
in UserAdmin and UserCreationForm classes, I had a problem with the Admin. 
 Everything in my project seemed to obey the swappable Meta tag in the User 
class except for the UserCreationForm.  I always got an error of:  Table 
does not exist: "auth_user" whenever getting past the first step of setting 
username and password.

Not being super familiar with forms in Django yet, I stepped through the 
debugger and found that this line in the form was the culprit:

 def clean_username(self):
# Since User.username is unique, this check is redundant,
# but it sets a nicer error message than the ORM. See #13147.
username = self.cleaned_data["username"]
try:
User._default_manager.get(username=username)
except User.DoesNotExist:
return username
raise 
forms.ValidationError(self.error_messages['duplicate_username'])

For some reason, User._default_manager.get refused to obey the switch the 
my CustomUser class.  User.anything_else seemed to be OK.  I resolved this 
by changing User._default_manager.get to my CustomUser._default_manager.get 
and now everything is peachy and going to the right table.

I have seen some posts that indicate when using a custom user class that 
new forms and UserAdmin classes must be rolled (or, *gasp*, copy-pasted,) 
so I'm wondering if this is the expected and correct behavior, am I missing 
something, or did I find a bug?

Thanks for reading and I look forward to participating in this awesome 
community.

Best,
-Eric

-- 
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.




Announcement: django-quickview 0.3 - putting the nitro in rapid web development

2013-02-27 Thread Thomas Weholt
pypi : https://pypi.python.org/pypi/django-quickview/
Source at https://bitbucket.org/weholt/django-quickview

Documentation and tutorial at
https://bitbucket.org/weholt/django-quickview/src/fde97a0a0befaeda0ab2317035f8e7cd9c311511/docs/basic.md?at=default
for details.

Bring on the flames ;-)

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.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: 1.5 custom user model: Add User with default UserCreationForm results in "no such table: auth_user"

2013-02-27 Thread carlos
check the docu
https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#custom-users-and-the-built-in-auth-forms

Cheers


On Wed, Feb 27, 2013 at 1:15 PM, Eric Psalmond  wrote:

> Hi everyone,
>
> After a bit of searching I didn't find an answer to this issue, so I
> thought I'd post here and see what the response was like.
>
> A little background:  I've been working with other frameworks and packages
> for years - from Websphere long ago to RoR and M$-MVC more recently.
>
> After using Django for about two weeks I'm 100% in love with it and have
> been singing its praises from the mountaintops.  Documentation is dead on
> and unlike anything else I've seen, and the ORM is for people that actually
> understand and like RDBMS, and in a day and age of No-SQL fads and PHP
> "developers," it has been very refreshing.  I was trying out Django
> alongside with a trendy new PHP framework that claimed to have great docs
> and ORM, but when implementing it I found it was a typical mess of
> documentation-by-forum and uniquely seemed to love the smell of its own
> farts more than any open source project I'd ever seen.
>
> If I had one complaint about Django, it would be lack of support for
> composite keys,  but I see enough work has already been done on that front
> that I might feel comfortable hacking something together, and it's so minor
> compared to all the other benefits that I can live with it.
>
> Anyway- on to my question:
>
> I rolled a custom user model since 1.5 was released yesterday.  I love the
> abstractions of AbstractUser and AbstractBaseUser, it totally makes sense.
>  However, when I rolled my own custom user class and tried to use the built
> in UserAdmin and UserCreationForm classes, I had a problem with the Admin.
>  Everything in my project seemed to obey the swappable Meta tag in the User
> class except for the UserCreationForm.  I always got an error of:  Table
> does not exist: "auth_user" whenever getting past the first step of setting
> username and password.
>
> Not being super familiar with forms in Django yet, I stepped through the
> debugger and found that this line in the form was the culprit:
>
>  def clean_username(self):
> # Since User.username is unique, this check is redundant,
> # but it sets a nicer error message than the ORM. See #13147.
> username = self.cleaned_data["username"]
> try:
> User._default_manager.get(username=username)
> except User.DoesNotExist:
> return username
> raise
> forms.ValidationError(self.error_messages['duplicate_username'])
>
> For some reason, User._default_manager.get refused to obey the switch the
> my CustomUser class.  User.anything_else seemed to be OK.  I resolved this
> by changing User._default_manager.get to my CustomUser._default_manager.get
> and now everything is peachy and going to the right table.
>
> I have seen some posts that indicate when using a custom user class that
> new forms and UserAdmin classes must be rolled (or, *gasp*, copy-pasted,)
> so I'm wondering if this is the expected and correct behavior, am I missing
> something, or did I find a bug?
>
> Thanks for reading and I look forward to participating in this awesome
> community.
>
> Best,
> -Eric
>
> --
> 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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread Hermann Kass
thank you; i'm happy because i wouldn't fight with Postgresql and
Postgis compilation

2013/2/27, Shawn Milochik :
> Ahh, the release of a new version of Django. Always a fantastic time
> to support the Django Software Foundation:
>
> https://www.djangoproject.com/foundation/donate/
>
> The money goes to support sprints and other things -- see the donate
> page for more details.
>
> --
> 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.
>
>
>


-- 
Hermann Kolemagah KASSALOUWA

-- 
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: ANNOUNCE: Django 1.5 released

2013-02-27 Thread frocco
Congratulation!!

Although I am fairly new to Django (PHP website), I really enjoy using it.
I appreciate all the hard work and look forward to a long relationship.
Everyone on the form here has been great and have helped me understand how 
Django works.

--Django convert. 

-- 
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 Shopping Cart

2013-02-27 Thread vijay shanker
hey, i want to write a shopping cart app, please provide some inputs, 
useful information, suggestions etc for doing it right .
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: 1.5 custom user model: Add User with default UserCreationForm results in "no such table: auth_user"

2013-02-27 Thread Eric Psalmond
"UserCreationForm

Depends on the 
User
 model. 
Must be re-written for any custom user model."
I swore I RTM'ed :).  Thanks!

I think it really doesn't depend on the User model - my class inherits from 
AbstractUser.  I think with the one modification I made, it works fine.  I 
think just a check in the form to see if AUTH_USER_MODEL is defined, and if 
so use that class instead of direct references to the User class would make 
it work 100% for any class that inherits from AbstractUser.

I've made no change to the UserChangeForm and it is working fine - in fact 
I've extended it somewhat by adding fields and such in my class that 
inherits AdminUser - everything working as expected in my Admin interface.

I mainly did this to keep using the built-in password hash functions, 
password reset, etc without having to maintain my own copy of it.

On Wednesday, February 27, 2013 1:43:27 PM UTC-6, sacrac wrote:
>
> check the docu
>
> https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#custom-users-and-the-built-in-auth-forms
>
> Cheers
>
>
> On Wed, Feb 27, 2013 at 1:15 PM, Eric Psalmond 
> > wrote:
>
>> Hi everyone,
>>
>> After a bit of searching I didn't find an answer to this issue, so I 
>> thought I'd post here and see what the response was like.
>>
>> A little background:  I've been working with other frameworks and 
>> packages for years - from Websphere long ago to RoR and M$-MVC more 
>> recently.
>>
>> After using Django for about two weeks I'm 100% in love with it and have 
>> been singing its praises from the mountaintops.  Documentation is dead on 
>> and unlike anything else I've seen, and the ORM is for people that actually 
>> understand and like RDBMS, and in a day and age of No-SQL fads and PHP 
>> "developers," it has been very refreshing.  I was trying out Django 
>> alongside with a trendy new PHP framework that claimed to have great docs 
>> and ORM, but when implementing it I found it was a typical mess of 
>> documentation-by-forum and uniquely seemed to love the smell of its own 
>> farts more than any open source project I'd ever seen.
>>
>> If I had one complaint about Django, it would be lack of support for 
>> composite keys,  but I see enough work has already been done on that front 
>> that I might feel comfortable hacking something together, and it's so minor 
>> compared to all the other benefits that I can live with it.
>>
>> Anyway- on to my question:
>>
>> I rolled a custom user model since 1.5 was released yesterday.  I love 
>> the abstractions of AbstractUser and AbstractBaseUser, it totally makes 
>> sense.  However, when I rolled my own custom user class and tried to use 
>> the built in UserAdmin and UserCreationForm classes, I had a problem with 
>> the Admin.  Everything in my project seemed to obey the swappable Meta tag 
>> in the User class except for the UserCreationForm.  I always got an error 
>> of:  Table does not exist: "auth_user" whenever getting past the first step 
>> of setting username and password.
>>
>> Not being super familiar with forms in Django yet, I stepped through the 
>> debugger and found that this line in the form was the culprit:
>>
>>  def clean_username(self):
>> # Since User.username is unique, this check is redundant,
>> # but it sets a nicer error message than the ORM. See #13147.
>> username = self.cleaned_data["username"]
>>  try:
>> User._default_manager.get(username=username)
>> except User.DoesNotExist:
>> return username
>> raise 
>> forms.ValidationError(self.error_messages['duplicate_username'])
>>
>> For some reason, User._default_manager.get refused to obey the switch the 
>> my CustomUser class.  User.anything_else seemed to be OK.  I resolved this 
>> by changing User._default_manager.get to my CustomUser._default_manager.get 
>> and now everything is peachy and going to the right table.
>>
>> I have seen some posts that indicate when using a custom user class that 
>> new forms and UserAdmin classes must be rolled (or, *gasp*, copy-pasted,) 
>> so I'm wondering if this is the expected and correct behavior, am I missing 
>> something, or did I find a bug?
>>
>> Thanks for reading and I look forward to participating in this awesome 
>> community.
>>
>> Best,
>> -Eric
>>
>> -- 
>> 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 mes

Re: Django Shopping Cart

2013-02-27 Thread Marc Aymerich
On Wed, Feb 27, 2013 at 10:02 PM, vijay shanker  wrote:

> hey, i want to write a shopping cart app, please provide some inputs,
> useful information, suggestions etc for doing it right .
> thanks
>


have you looked at django-oscar?

-- 
Marc

-- 
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.




manage.py and django-admin.py help

2013-02-27 Thread Clientkill
Can someone tell me why, even after trying everything, I can't open either 
manage.py or django-admin.py? I have apt-get installed django and its 
registration package, and calling manage.py or django-admin.py returns:
manage.py: command not found

-- 
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.




blank and null with Oracle

2013-02-27 Thread Skylar Saveland
Some odd behavior with Oracle involving blank and null.

blank is True on this field:
my_auto = models.AutoField(blank=False, null=False, primary_key=True)

null is True on this field:
uncles = models.ManyToManyField(Uncle, blank=False, null=False) 

null is True on this field:
photo = models.ImageField(upload_to="uploads/") 

And, then, as documented null=True on CharFields.

The most disturbing thing is that blank/null on the first two examples are 
the opposite of what is explicitly declared.

Should I post this on django-developers. Is this behavior documented? Are 
this problems/quirks known?

-Skylar

-- 
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: manage.py and django-admin.py help

2013-02-27 Thread Karen Tracey
On Wed, Feb 27, 2013 at 5:27 PM, Clientkill  wrote:

> Can someone tell me why, even after trying everything, I can't open either
> manage.py or django-admin.py? I have apt-get installed django and its
> registration package, and calling manage.py or django-admin.py returns:
> manage.py: command not found


Mention of apt-get makes me think you're using a linux distribution where
the packaging has renamed django-admin.py to just django-admin, so try just
django-admin. You won't have a manage.py until you get django_admin
startproject to run successfully.

Karen

-- 
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: I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-27 Thread Rainy



On Wednesday, February 27, 2013 11:28:50 AM UTC-5, Mark London wrote:
>
> I need a widget or a method that allows users to select items from a list 
> of choices, or add a new choice.   Someone on stackoverflow asked the same 
> question, and got a kludgy answer:
>
>
> http://stackoverflow.com/questions/14802167/how-do-i-make-a-django-choicefield-accept-both-preset-choices-and-the-addition-
>
> There should be a better way than this.  Thanks.
>
> - Mark 
>



Take a look at SelectOrCreateField (and its widget) here:

http://lightbird.net/dbe2/issues.html#selectorcreatefield


The screenshot is here:

http://lightbird.net/dbe2/issues.html#addissues-template


 -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: Django IRC & sqlite3 .schema

2013-02-27 Thread Dorian Kiss
Cheers. I actually worked out the search function after I posted the 
question and found your answer to the IRC question somewhere else. I looked 
everywhere for the search function except the giant search bar at the top 
of the screen =D However, whilst I've now registered with NickServ, I still 
can't find my way into anywhere where anyone is chatting, or where I can 
chat myself. If I try to chat I get 'Can't use this command in this window' and 
I tried some commands which appeared to have potential from 
http://freenode.net/faq.shtml#webchat 
with no luck(There was nothing obvious). I got 'Channel modes on #channel are: 
+imnstf' from one command which may help you figure out where I am..?

As for the sqlite3 question: I've django-admin.py startproject mysite; 
configured mysite/settings.py and python manage.py syncdb. So, I have a 
sq3.db sqlite3 database in the outer mysite directory:
mysite/
manage.py
sq3.db
mysite/
__init__.py
settings.py
urls.py
wsgi.py

I've then tried to proceed by following: 'If you’re interested, run the 
command-line client for your database and type \dt (PostgreSQL),SHOW TABLES; 
(MySQL), 
or .schema (SQLite) to display the tables Django created.'

I don't know what the command-line client for my database is(I'm using the 
windows(DOS) 'Command Prompt', but after searching Google I came across the 
web page 'http://curioushq.blogspot.co.uk/2011/05/django-tutorial.html', 
which says: 
'So on the command prompt, I type in sqlite3 nameofdbcreated.db and then 
once inside, type in .schema to create and list the databases.' 

Though, when I enter 'sqlite3 sq3.db' from within either C:\ or my outer 
mysite folder I get the response: 'sqlite3' is not recognized as an 
internal or external command,
operable program or batch file.'

Of course, I haven't gotten any further than that.

I have wondered if this is because I need to set up a path inside the 
windows environment variables like I did(though apparently unnecessarily) 
for Django as a whole.

-- 
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: manage.py and django-admin.py help

2013-02-27 Thread Clientkill

Thank you so much!
On Wednesday, 27 February 2013 17:36:15 UTC-5, Karen Tracey wrote:
>
> On Wed, Feb 27, 2013 at 5:27 PM, Clientkill 
> > wrote:
>
>> Can someone tell me why, even after trying everything, I can't open 
>> either manage.py or django-admin.py? I have apt-get installed django and 
>> its registration package, and calling manage.py or django-admin.py returns:
>> manage.py: command not found
>
>
> Mention of apt-get makes me think you're using a linux distribution where 
> the packaging has renamed django-admin.py to just django-admin, so try just 
> django-admin. You won't have a manage.py until you get django_admin 
> startproject to run successfully.
>
> Karen
>

-- 
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: manage.py and django-admin.py help

2013-02-27 Thread Clientkill
It appears that Settings cannot be imported, because environment variable 
DJANGO_SETTINGS_MODULE is undefined. I did a google search on this, but it 
reared no valuable results. Can anyone help?


On Wednesday, 27 February 2013 17:27:01 UTC-5, Clientkill wrote:
>
> Can someone tell me why, even after trying everything, I can't open either 
> manage.py or django-admin.py? I have apt-get installed django and its 
> registration package, and calling manage.py or django-admin.py returns:
> manage.py: command not found
>
>

-- 
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: manage.py and django-admin.py help

2013-02-27 Thread Mike Dewhirst

On 28/02/2013 11:02am, Clientkill wrote:

It appears that Settings cannot be imported, because environment
variable DJANGO_SETTINGS_MODULE is undefined. I did a google search on
this, but it reared no valuable results. Can anyone help?


Your wsgi file (the server's entry-point for the site) needs to put your 
project into sys.path


Here is mine ...

from __future__ import unicode_literals
# -*- coding: utf-8 -*-
# application entry point

site = "mysite"
project = "myproject"
srvroot = "/var/www"
site_root = "%s/%s" % (srvroot, site)
project_root = "%s/%s" % (site_root, project)

import os
import sys

if site_root not in sys.path:
sys.path.insert(0, site_root)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "%s.settings" % project)
os.environ.setdefault("PYTHON_EGG_CACHE", site_root)
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
---

IIRC, having __init__.py in site_root makes this work. Otherwise I think 
I might have previously used project_root instead.


hth

Mike





On Wednesday, 27 February 2013 17:27:01 UTC-5, Clientkill wrote:

Can someone tell me why, even after trying everything, I can't open
either manage.py or django-admin.py? I have apt-get installed django
and its registration package, and calling manage.py or
django-admin.py returns:
manage.py: command not found

--
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: manage.py and django-admin.py help

2013-02-27 Thread Clientkill
this is the most confusing process I've ever done. I wish the django IRC 
channel was open

On Wednesday, 27 February 2013 17:27:01 UTC-5, Clientkill wrote:
>
> Can someone tell me why, even after trying everything, I can't open either 
> manage.py or django-admin.py? I have apt-get installed django and its 
> registration package, and calling manage.py or django-admin.py returns:
> manage.py: command not found
>
>

-- 
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.




Need to get a distinct category list from many to many

2013-02-27 Thread frocco
Hello,

I Have a product table that has a many to many relation to a category table.

When I query the products, I want to display a unique list of the 
categories associated with the product query.

product table
product_id
categories = models.ManyToManyField(Category, related_name="cat")

category table
category_id

product_category table
product_id
category_id

I tried this, but it is not working.
c = Product.objects.filter(keywords__contains=search, 
is_active=True).distinct('category_id')

-- 
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: Announcement: django-quickview 0.3 - putting the nitro in rapid web development

2013-02-27 Thread Bino Oetomo


On Feb 28, 2:39 am, Thomas Weholt  wrote:
>
> Documentation and tutorial 
> athttps://bitbucket.org/weholt/django-quickview/src/fde97a0a0befaeda0ab...
> for details.
>
Some how I failed to install .
The pip log pasted at http://pastebin.com/ZNcc8CuH

Sincerely
-bino-

-- 
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.




default filtering model admin (crud) using user obj attribute

2013-02-27 Thread Bino Oetomo
Dear All..

Currently I have custom authentication backend,
This backend return user-object with additional attributes

START
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from l2auth.models import Company
>>> from csm.models import L2User, L2Group
>>> from l2auth.backends import L2Backend
>>> myauth = L2Backend()
>>> myauth.authenticate('user02@binonet','')
L2Backend => user02@binonet 
['user02', 'binonet']
company_id => 1
user==> user02

>>> myuser=myauth.authenticate('user02@binonet','')
L2Backend => user02@binonet 
['user02', 'binonet']
company_id => 1
user==> user02
>>> myuser.company_id

>>>
>>> myuserdict=myuser.__dict__
>>> myuserdict
{'username': u'user02', 'first_name': u'user 02', 'last_name': u'of
binonet', '_state': , '_company_id_cache': , 'company_id_id':
1, 'email': u'', 'is_active': True, 'is_superuser': False, 'is_staff':
False, 'last_login': datetime.datetime(2013, 2, 28, 7, 1, 41, 521980,
tzinfo=), 'password': u'pbkdf2_sha256$1$0NrkpAjo4osS
$nFdAVaH9mlAbE9vzAvlj+aQeTP7gQsUpFZLZTYOVggs=', 'id': 2,
'date_joined': datetime.datetime(2013, 2, 28, 6, 58, 41,
tzinfo=)}
>>> myuser.company_id_id
1
STOP-

My concern is 'myuser.company_id', this attribute is a ForeignKey to
'Company' model.

I also have 'Car' model like :
--START
class Car(models.Model) :
company_id = models.ForeignKey()
badge = models.CharField('Badge', max_length=10)
--STOP-

By Default, every user login .. he/she have full access (CrUD) to all
cars, including other company's car.

My question is how to make :
1. Car list : Only show cars with company_id=myuser.company_id
2. Create/Update : 'Company choice list' locked to the one with
value=myuser.company_id
3. Delete : Only posible for Car.company_id=myuser.company_id

Kindly please give me any of your enlighten.

Sincerely
-bino-

-- 
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.