Re: View for creating, listing, and deleting

2013-10-14 Thread Leonardo Giordani
Hi,

you are submitting two different problems, if I correctly understand your
question. The first is about Create Read Update Delete objects, the second
is about code reuse.

1. CRUD
>From the user's point of view you should create a page with the list of
objects, then provide a way to selectively delete some of them, and a way
to create a new object.
For example you could have a button near each object that deletes it, and a
general button that creates a new object.

The create button shall perform a GET on a page with a form, which in turn,
when saved, shall perform a POST. This is done by a view (CreateView, if
you want to use class based generic views). The delete button shall perform
a POST, and this is usually done by hiding a prefilled form and submitting
it through JS when pressing the delete button.

2. Code reuse
Since class-based generic views get a model as a parameter, I'd create a
Factory, i.e. a class that returns a class. You can then loop over your
models and call the Factory, generating urls on-th-fly.


Does this make sense for you? Let me know
Cheers,

Leo


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/12 

> I'm working on a project in which on a certain page I want to have a list
> of objects as well as the ability to delete and create them. I know that
> there are class-based generic views for these things, but I don't want
> three separate pages for these operations. What would be the best way to
> have them all on one page?
>
> I'm guessing the right way to do it is to make a new class-based view for
> viewing, deleting, and listing objects of a certain kind and then to
> subclass for every object I need to list, create, or view, but I thought
> I'd make sure that's the best way to do it first.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/44556c9b-8712-401c-b92b-62e124d1c93c%40googlegroups.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOkJL4ecO5WmU_ZL1znqYTVSD2EaEXFYgAGkXd3A25nEww%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Leonardo Giordani
Hi, are you using a virtualenv? In that case, can you post the list of
packages you installed? If not, can you give details about the OS you are
working on, Django version, and so on?

Regards,

Leo

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/14 Darion Yaphet 

> Hi all :
>
> when I use django-admin.py to init django project
> django-admin.py  startproject hello
>
> Got a exception ..
>  AttributeError: 'module' object has no attribute '_handlerList'
>
> what is it 
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Darion Yaphet
Python  2.7.3 and Django is 1.5.3 ..


2013/10/14 Leonardo Giordani 

> Hi, are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on, Django version, and so on?
>
> Regards,
>
> Leo
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>> Hi all :
>>
>> when I use django-admin.py to init django project
>> django-admin.py  startproject hello
>>
>> Got a exception ..
>>  AttributeError: 'module' object has no attribute '_handlerList'
>>
>> what is it 
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>> .
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 


long is the way and hard  that out of Hell leads up to light

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Leonardo Giordani
Please give me the information I asked you, otherwise I cannot figure out
what kind of problem you have.

Are you using a virtualenv? In that case, can you post the list of packages
you installed? If not, can you give details about the OS you are working on?

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/14 Darion Yaphet 

> Python  2.7.3 and Django is 1.5.3 ..
>
>
> 2013/10/14 Leonardo Giordani 
>
>> Hi, are you using a virtualenv? In that case, can you post the list of
>> packages you installed? If not, can you give details about the OS you are
>> working on, Django version, and so on?
>>
>> Regards,
>>
>> Leo
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/14 Darion Yaphet 
>>
>>> Hi all :
>>>
>>> when I use django-admin.py to init django project
>>> django-admin.py  startproject hello
>>>
>>> Got a exception ..
>>>  AttributeError: 'module' object has no attribute '_handlerList'
>>>
>>> what is it 
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>>> .
>>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
>
>
> long is the way and hard  that out of Hell leads up to light
>
>  --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com
> .
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3D-D_WzBa4_Lis4Bppak-czSKG9D60b91b7GFSWvnWM%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Looking for a way to detect changes in database records with low storage footprint

2013-10-14 Thread DJ-Tom

Thanks, this might be a way to go - since the .extra() method may create a 
dependency on the SQL dialect used I will have to be careful though ;-)

Am Donnerstag, 10. Oktober 2013 19:01:32 UTC+2 schrieb Tom Evans:
>
> This is not a full solution, but you can select out extra fields (and 
> then subsequently filter on them) using the .extra() method on 
> querysets. 
>
> Eg, if you were using mysql and wanted a field that was a hash of pk 
> (id), first_name and last_name fields, then you could do something 
> like so: 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d696e62a-29ec-4683-ab7d-d72c5eea7af6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How do I correctly encode filenames for use in https-response "content-disposition" header?

2013-10-14 Thread DJ-Tom
Good idea - I will try if this helps - for now I'm replacing spaces with 
underscores which works as well.

Am Freitag, 11. Oktober 2013 16:29:32 UTC+2 schrieb ke1g:
>
> Not sure, but perhaps you need quotes around the file name to avoid having 
> the user agent terminate the filename on space?  E.g.;
> ..."attachement; filename=" + '"' + rep_setup..+ '.xlsx"'
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b98efcd8-eae5-4262-89b7-e7a13dc5621b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


on update foreign key django edit doesn't work

2013-10-14 Thread Mirza Delic
I did manualy on db "ON UPDATE CASCADE", and when i update foreign key on 
db side it works, but when i try to change on django, it shows me error "list 
index out of range".
How can i solve this?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/306326e3-35e5-4c11-a525-42951751e284%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
I can't get logging in with alternate auth backends to work with Django 1.4
or newer.

Basically:

1. authenticate() works. request.user.is_authenticated() is True
2. Django's own login() seems to work, as request.user is set,
request.session is set etc.
3. After the HttpResponseRedirect, request.user is AnonymousUser

This has happened twice now, with different alternate auth backends. I
can't get rid of Django 1.3 before this is fixed...

In one project I can call the next view directly (with render) and it Just
Works. In the current project, the next view contains a form, and the
"login" doesn't survive the POST.

What am I missing? See also the non-solution in
http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect


HM

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Sergiy Khohlov
I have no idea why are you writing this code  by yourself ?
 This  is already done  !
 Take a look at
https://github.com/django/django/blob/master/django/contrib/auth/views.py

 login function is already done  and you can  use it .  Have no sense
to write it by yourself.
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa  wrote:
> I can't get logging in with alternate auth backends to work with Django 1.4
> or newer.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
>
> In one project I can call the next view directly (with render) and it Just
> Works. In the current project, the next view contains a form, and the
> "login" doesn't survive the POST.
>
> What am I missing? See also the non-solution in
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>
>
> HM
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJO%2BwGM0GtyECQiNEAQFJq-nqSQEn5vefPGU6oJx%3DJS8PA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Sergiy Khohlov
 Take a look  at :
if form.is_valid():
#django.contrib.auth.login
Login(request, form.get_user())
str = reverse('cm_base.views.index')
return HttpResponseRedirect(str)
else:
# Their password / email combination must have been incorrect
pass

you  are verifying fields only. No more. And invalid creadentials (
correct for form) are  never go to else  block
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Mon, Oct 14, 2013 at 4:01 PM, Sergiy Khohlov  wrote:
> I have no idea why are you writing this code  by yourself ?
>  This  is already done  !
>  Take a look at
> https://github.com/django/django/blob/master/django/contrib/auth/views.py
>
>  login function is already done  and you can  use it .  Have no sense
> to write it by yourself.
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa  wrote:
>> I can't get logging in with alternate auth backends to work with Django 1.4
>> or newer.
>>
>> Basically:
>>
>> 1. authenticate() works. request.user.is_authenticated() is True
>> 2. Django's own login() seems to work, as request.user is set,
>> request.session is set etc.
>> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>>
>> This has happened twice now, with different alternate auth backends. I can't
>> get rid of Django 1.3 before this is fixed...
>>
>> In one project I can call the next view directly (with render) and it Just
>> Works. In the current project, the next view contains a form, and the
>> "login" doesn't survive the POST.
>>
>> What am I missing? See also the non-solution in
>> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>>
>>
>> HM
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJOnf8EkaR6tU5YMcKQ64GNOrHP7ShGKy2s4Wo6%3Dq1WU%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
Why not assume that I have a reason not to use the ready-made stuff?

The User-object has several passwords connected, wuhch represent passwords
elsewhere, which can be different. Which password to check is set on the
login-page, and after login the only page available is one where those
passwords can be changed.


On 14 October 2013 15:01, Sergiy Khohlov  wrote:

> I have no idea why are you writing this code  by yourself ?
>  This  is already done  !
>  Take a look at
> https://github.com/django/django/blob/master/django/contrib/auth/views.py
>
>  login function is already done  and you can  use it .  Have no sense
> to write it by yourself.
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa  wrote:
> > I can't get logging in with alternate auth backends to work with Django
> 1.4
> > or newer.
> >
> > Basically:
> >
> > 1. authenticate() works. request.user.is_authenticated() is True
> > 2. Django's own login() seems to work, as request.user is set,
> > request.session is set etc.
> > 3. After the HttpResponseRedirect, request.user is AnonymousUser
> >
> > This has happened twice now, with different alternate auth backends. I
> can't
> > get rid of Django 1.3 before this is fixed...
> >
> > In one project I can call the next view directly (with render) and it
> Just
> > Works. In the current project, the next view contains a form, and the
> > "login" doesn't survive the POST.
> >
> > What am I missing? See also the non-solution in
> >
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
> >
> >
> > HM
> >
> > --
> > 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.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com
> .
> > 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADTRxJO%2BwGM0GtyECQiNEAQFJq-nqSQEn5vefPGU6oJx%3DJS8PA%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrrdiG8nf9LJ1DrHLskBUerG2U3xHwyjDjLDSqJ7_TDRDyA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
That's not my code, that's the first hit on google for my problem. I use
django's own login() to login the user.


On 14 October 2013 15:07, Sergiy Khohlov  wrote:

>  Take a look  at :
> if form.is_valid():
> #django.contrib.auth.login
> Login(request, form.get_user())
> str = reverse('cm_base.views.index')
> return HttpResponseRedirect(str)
> else:
> # Their password / email combination must have been incorrect
> pass
>
> you  are verifying fields only. No more. And invalid creadentials (
> correct for form) are  never go to else  block
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Mon, Oct 14, 2013 at 4:01 PM, Sergiy Khohlov 
> wrote:
> > I have no idea why are you writing this code  by yourself ?
> >  This  is already done  !
> >  Take a look at
> >
> https://github.com/django/django/blob/master/django/contrib/auth/views.py
> >
> >  login function is already done  and you can  use it .  Have no sense
> > to write it by yourself.
> > Many thanks,
> >
> > Serge
> >
> >
> > +380 636150445
> > skype: skhohlov
> >
> >
> > On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa  wrote:
> >> I can't get logging in with alternate auth backends to work with Django
> 1.4
> >> or newer.
> >>
> >> Basically:
> >>
> >> 1. authenticate() works. request.user.is_authenticated() is True
> >> 2. Django's own login() seems to work, as request.user is set,
> >> request.session is set etc.
> >> 3. After the HttpResponseRedirect, request.user is AnonymousUser
> >>
> >> This has happened twice now, with different alternate auth backends. I
> can't
> >> get rid of Django 1.3 before this is fixed...
> >>
> >> In one project I can call the next view directly (with render) and it
> Just
> >> Works. In the current project, the next view contains a form, and the
> >> "login" doesn't survive the POST.
> >>
> >> What am I missing? See also the non-solution in
> >>
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
> >>
> >>
> >> HM
> >>
> >> --
> >> 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.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com
> .
> >> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADTRxJOnf8EkaR6tU5YMcKQ64GNOrHP7ShGKy2s4Wo6%3Dq1WU%3Dg%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3Drre2CHhJdbX2gwObHOZkioZ-6H0vjCK-ujvBfYPjNewx3g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Image browsing in django

2013-10-14 Thread Harjot Mann
On Fri, Oct 11, 2013 at 3:44 PM, Tom Evans  wrote:
> Forms containing files must have encoding type of
> "multipart/form-data" or the file will not be submitted with the rest
> of the form.


Didn't get you here. My problem is this that when I am browsing for
image ita takes int he upload area but when I submit, it gives me an
error no files selected?

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0GQhBtxKYNEbT0pEVjw6P97z%3DbXMeMCJ_0t8q3QfVbGv3Oyg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Sergiy Khohlov
Please post a example code.
one user  with two password with different permission  is not easy to
understand idea for me :-)
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Mon, Oct 14, 2013 at 4:14 PM, Hanne Moa  wrote:
> That's not my code, that's the first hit on google for my problem. I use
> django's own login() to login the user.
>
>
> On 14 October 2013 15:07, Sergiy Khohlov  wrote:
>>
>>  Take a look  at :
>> if form.is_valid():
>> #django.contrib.auth.login
>> Login(request, form.get_user())
>> str = reverse('cm_base.views.index')
>> return HttpResponseRedirect(str)
>> else:
>> # Their password / email combination must have been incorrect
>> pass
>>
>> you  are verifying fields only. No more. And invalid creadentials (
>> correct for form) are  never go to else  block
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>>
>> On Mon, Oct 14, 2013 at 4:01 PM, Sergiy Khohlov 
>> wrote:
>> > I have no idea why are you writing this code  by yourself ?
>> >  This  is already done  !
>> >  Take a look at
>> >
>> > https://github.com/django/django/blob/master/django/contrib/auth/views.py
>> >
>> >  login function is already done  and you can  use it .  Have no sense
>> > to write it by yourself.
>> > Many thanks,
>> >
>> > Serge
>> >
>> >
>> > +380 636150445
>> > skype: skhohlov
>> >
>> >
>> > On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa  wrote:
>> >> I can't get logging in with alternate auth backends to work with Django
>> >> 1.4
>> >> or newer.
>> >>
>> >> Basically:
>> >>
>> >> 1. authenticate() works. request.user.is_authenticated() is True
>> >> 2. Django's own login() seems to work, as request.user is set,
>> >> request.session is set etc.
>> >> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>> >>
>> >> This has happened twice now, with different alternate auth backends. I
>> >> can't
>> >> get rid of Django 1.3 before this is fixed...
>> >>
>> >> In one project I can call the next view directly (with render) and it
>> >> Just
>> >> Works. In the current project, the next view contains a form, and the
>> >> "login" doesn't survive the POST.
>> >>
>> >> What am I missing? See also the non-solution in
>> >>
>> >> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>> >>
>> >>
>> >> HM
>> >>
>> >> --
>> >> 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.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
>> >> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CADTRxJOnf8EkaR6tU5YMcKQ64GNOrHP7ShGKy2s4Wo6%3Dq1WU%3Dg%40mail.gmail.com.
>>
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACQ%3Drre2CHhJdbX2gwObHOZkioZ-6H0vjCK-ujvBfYPjNewx3g%40mail.gmail.com.
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJO12SDeJ3C-4xvpemE-N0rg2fY%2Bp3dUUy%3DNzTeN8Hwtqg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: on update foreign key django edit doesn't work

2013-10-14 Thread Harjot Mann
On Mon, Oct 14, 2013 at 5:56 PM, Mirza Delic  wrote:
> I did manualy on db "ON UPDATE CASCADE", and when i update foreign key on db
> side it works, but when i try to change on django, it shows me error "list
> index out of range".
> How can i solve this?


Can you please show the code?

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0GQhA7cH3THpkDuhJdKq%2BF-hHFO%2BkSEX3x71McSn4F4J9XbA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Image browsing in django

2013-10-14 Thread Tom Evans
On Mon, Oct 14, 2013 at 2:25 PM, Harjot Mann  wrote:
> On Fri, Oct 11, 2013 at 3:44 PM, Tom Evans  wrote:
>> Forms containing files must have encoding type of
>> "multipart/form-data" or the file will not be submitted with the rest
>> of the form.
>
>
> Didn't get you here. My problem is this that when I am browsing for
> image ita takes int he upload area but when I submit, it gives me an
> error no files selected?
>

Yes, this is what I said before. Forms that contain files must be
specified in the HTML differently than forms that do not contain
files, or when the form is submitted, the file will not be submitted
along with the form.

Forms with files must have an encoding attribute set on the 
element, eg "". If they do
not, files will not be submitted when the form is submitted.

The stackoverflow page I linked to previously explains why in detail.

Cheers

Tom

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KS019SOenyYBW604RcRgwD5gj-bQqWiQHZhL%3DVbmV3eA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Tom Evans
On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa  wrote:
> I can't get logging in with alternate auth backends to work with Django 1.4
> or newer.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
>
> In one project I can call the next view directly (with render) and it Just
> Works. In the current project, the next view contains a form, and the
> "login" doesn't survive the POST.
>
> What am I missing? See also the non-solution in
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>

Are you sure sessions are working correctly? Are you setting cookies
(for session or otherwise) with a different host name than you are
serving from?

Use a browser that allows you to inspect and capture web requests
(chrome, firefox etc), capture the login sequence and look at the
cookies that are being set.

Cheers

Tom

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2BJG9qmAYCk5bEvK%2BOa6YdQ3CiJuKN3gRka6SzfvK7fhw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: unable to access django development server on firefox/chrome

2013-10-14 Thread Tom Evans
On Sat, Oct 12, 2013 at 6:02 PM, gitrookie  wrote:
> hi
>
> I have just started to learn django. so I followed the instruction given in
> the link below. I am using ubuntu 13.04 and using python 3.3.1 in a virtual
> environment
>
> https://docs.djangoproject.com/en/1.5/intro/tutorial01/
>
> I ran the following command
>
> python manage.py runserver
>
> it gave the following output
>
> Validating models...
>
> 0 errors found
> October 12, 2013 - 11:37:58
> Django version 1.5.4, using settings 'mywebsite.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
>
> But I am unable to access the url http://127.0.0.1:8000/ on firefox. It says
> unable to connect
>

Is the box you are running django on the same box you are running firefox from?

Cheers

Tom

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KV%2Bp9yNCZDNRZU9cCEWc%2BTNgUuaVXRP2Z0Sjm2dxeWSg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Image browsing in django

2013-10-14 Thread Harjot Mann
On Mon, Oct 14, 2013 at 8:34 PM, Tom Evans  wrote:
> Yes, this is what I said before. Forms that contain files must be
> specified in the HTML differently than forms that do not contain
> files, or when the form is submitted, the file will not be submitted
> along with the form.
>
> Forms with files must have an encoding attribute set on the 
> element, eg "". If they do
> not, files will not be submitted when the form is submitted.


Done..but again getting the same error. I am doing it like this:
This is my model:
image=models.ImageField(upload_to='images')

and then in my html form I am doing it like this:

 {% csrf_token %}
 
{{ form.as_table }}
 
 
   

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0GQhBcGawwNxLYrphHuMeusH34EOuZO9Q5pDtpX%3D6ri1r%3D8g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Image browsing in django

2013-10-14 Thread Harjot Mann
On Mon, Oct 14, 2013 at 9:46 PM, Harjot Mann  wrote:
> Done..but again getting the same error. I am doing it like this:
> This is my model:
> image=models.ImageField(upload_to='images')
>
> and then in my html form I am doing it like this:
> 
>  {% csrf_token %}
>  
> {{ form.as_table }}
>  
>  
>


I have not done anything special in views..it just contains a simple
form saving code.
Should I need to do anything there?
-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0GQhBPX54KosXS-m9PEBGEPZArGNhCxwfQdXEfgPoGPrPH6g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Defining new project as a service at nignx

2013-10-14 Thread Muhammed TÜFEKYAPAN
Hello everybody,


I use digitalocean as a server. I upload my django project files on my 
server and start to setup. Made postgresql settings etc but I can't define 
my new project as a new service on nginx. How can I define my new projest 
as a service and make possible to start it as "service blabla start". 

When I type "service --statıs-all" I can't see my new project now. 


Best.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d38d8218-5dc5-444c-be0c-b440954cd440%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-14 Thread carlos
Hi you need read this

http://wiki.nginx.org/ServerBlockExample

http://wiki.nginx.org/DjangoFastCGI

Cheers


On Mon, Oct 14, 2013 at 11:17 AM, Muhammed TÜFEKYAPAN  wrote:

> Hello everybody,
>
>
> I use digitalocean as a server. I upload my django project files on my
> server and start to setup. Made postgresql settings etc but I can't define
> my new project as a new service on nginx. How can I define my new projest
> as a service and make possible to start it as "service blabla start".
>
> When I type "service --statıs-all" I can't see my new project now.
>
>
> Best.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d38d8218-5dc5-444c-be0c-b440954cd440%40googlegroups.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM-7rO3FukccUYmhjK-awcESQZ-2ntg6rfV459M25fa-6kiMUA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-14 Thread Muhammed TÜFEKYAPAN
First of all, thanks for answer.

I read these two links but I can't find any information for my problem.

I write boot file and make required changes in the sites-avaiable folder. 
Even this, nginx don't see my project. 

I still need help.

On Monday, October 14, 2013 9:22:34 PM UTC+3, sacrac wrote:
>
> Hi you need read this 
>
> http://wiki.nginx.org/ServerBlockExample
>
> http://wiki.nginx.org/DjangoFastCGI
>
> Cheers
>
>
> On Mon, Oct 14, 2013 at 11:17 AM, Muhammed TÜFEKYAPAN 
> 
> > wrote:
>
>> Hello everybody,
>>
>>
>> I use digitalocean as a server. I upload my django project files on my 
>> server and start to setup. Made postgresql settings etc but I can't define 
>> my new project as a new service on nginx. How can I define my new projest 
>> as a service and make possible to start it as "service blabla start". 
>>
>> When I type "service --statıs-all" I can't see my new project now. 
>>
>>
>> Best.
>>  
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d38d8218-5dc5-444c-be0c-b440954cd440%40googlegroups.com
>> .
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37cbcfad-fd68-4be6-83a8-b2725b7c1490%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-14 Thread Javier Guerra Giraldez
On Mon, Oct 14, 2013 at 12:17 PM, Muhammed TÜFEKYAPAN
 wrote:
> I use digitalocean as a server. I upload my django project files on my
> server and start to setup. Made postgresql settings etc but I can't define
> my new project as a new service on nginx. How can I define my new projest as
> a service and make possible to start it as "service blabla start".
>
> When I type "service --statıs-all" I can't see my new project now.


i think you're mixing two things and missing a third.

1: AFAIK, nginx doesn't have "services", just serves requests via some
methods, either static files, internal plugins or backend servers.

2: on most linux distros, the 'service' command manages startup
scripts; with start/stop commands to run daemons.

3: nginx doesn't run python applications, you have to run them in an
app server.  for Django, (and most python frameworks), the best option
is a wsgi server.  One that runs really well with nginx is uWSGI.
another option is to run gunicorn as an HTTP backend server behind
nginx.


so, which is your deployment strategy?
(https://docs.djangoproject.com/en/1.6/howto/deployment/)


-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoQhk7BtAz8aDQZv79cea76A3MJM-tpWVToPhr-3jAPKdw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


New to Django cannot figure URLpatterns

2013-10-14 Thread Mark Strickland
I am new to using Django and I can get one urls to work, but I cannot get 
another.  I am running Django 1.5

This url works.

url(r'^$', views.index, name='index'),


But if I try to follow this one.

 url(r'^(?P\D+)/$', views.detail, name='detail'),


I get the following error.when I try http://127.0.0.1:8000/plugin/title 
where title is a unique key in the database.

Page not found (404)
Request Method:GETRequest URL:http://127.0.0.1:8000/plugin/cbs/

Using the URLconf defined in urlconf, Django tried these URL patterns, in 
this order:


   1. ^__debug__/m/(.*)$
  2. ^__debug__/sql_select/$ [name='sql_select']
  3. ^__debug__/sql_explain/$ [name='sql_explain']
  4. ^__debug__/sql_profile/$ [name='sql_profile']
  5. ^__debug__/template_source/$ [name='template_source']
  6. ^admin/doc/
  7. ^admin/
  8. ^plugin/ ^(?P\d+)/$ [name='detail']
  9. ^plugin/ ^$ [name='index']
   
The current URL, plugin/cbs/, didn't match any of these. 


Any and all help or guidance would be greatly appreciated. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d625e8e-ff23-4411-a0e2-503b8496c286%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New to Django cannot figure URLpatterns

2013-10-14 Thread Tom Lockhart

On 2013-10-14, at 3:58 PM, Mark Strickland  wrote:

> I am new to using Django and I can get one urls to work, but I cannot get 
> another.  I am running Django 1.5
> 
> This url works.
> 
> url(r'^$', views.index, name='index'),
> 
> But if I try to follow this one.
> 
>  url(r'^(?P\D+)/$', views.detail, name='detail'),

Look at item 8 in the debug message below. I think you want something like

url(r'^/plugin/(?P\D+)/$', views.detail, name='detail'),

for the URL you want to match.

hth

 - Tom


> 
> I get the following error.when I try http://127.0.0.1:8000/plugin/title where 
> title is a unique key in the database.
> 
> Page not found (404)
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/plugin/cbs/
> Using the URLconf defined in urlconf, Django tried these URL patterns, in 
> this order:
> ^__debug__/m/(.*)$
> ^__debug__/sql_select/$ [name='sql_select']
> ^__debug__/sql_explain/$ [name='sql_explain']
> ^__debug__/sql_profile/$ [name='sql_profile']
> ^__debug__/template_source/$ [name='template_source']
> ^admin/doc/
> ^admin/
> ^plugin/ ^(?P\d+)/$ [name='detail']
> ^plugin/ ^$ [name='index']
> The current URL, plugin/cbs/, didn't match any of these. 
> 
> Any and all help or guidance would be greatly appreciated. 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/3d625e8e-ff23-4411-a0e2-503b8496c286%40googlegroups.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02B1044E-EE5C-47DC-AA56-1F466E53ED24%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


def altword_list(self, request, word_id):

2013-10-14 Thread Pepsodent Cola
Hi,

I got some help by somebody on #django IRC.  They gave me this code snippet 
to fix my problem.  But I'm having problems incorporating that code into my 
Class file because Template file says "No list is available" when I try to 
access the list variable.  What am I doing wrong?

# Filter 8
def altword_list(self, request, word_id):
#object_list = 
AltWord.objects.filter(word__pk=word_id).order_by('-votes')
object_list = 
Altword.objects.filter(word__pk=word_id).order_by('-votes')

return render(request, 'navi_polls/altword_list.html', {
'poll_list': object_list,
})



*Views*
#___

class AltwordlistView(generic.DetailView):
#model = Word
model = Altword
template_name = 'navi_polls/altword_list.html'
context_object_name = 'poll'

def get_queryset(self):
# Filter 5
#return Word.objects.filter(direct_transl_word='')


def get_context_data(self, **kwargs):
context = super(AltwordlistView, self).get_context_data(**kwargs)
# Filter 4b
filter_4b = 
Altword.objects.filter(rosword__direct_transl_word='').order_by('-votes')
# Filter 7
filter_7 = Altword.objects.vote_order()
# Filter 8b
#filter_8b = 
Altword.objects.filter(word__pk=word_id).order_by('-votes')


context.update({
"filter_4b": filter_4b,
"filter_7": filter_7
 #   "filter_8b": filter_8b
})
return context


# Filter 8
def altword_list(self, request, word_id):
#object_list = 
AltWord.objects.filter(word__pk=word_id).order_by('-votes')
object_list = 
Altword.objects.filter(word__pk=word_id).order_by('-votes')

return render(request, 'navi_polls/altword_list.html', {
'poll_list': object_list,
})
#___
*
*


*Template*
#___


{% if poll_list %}

{% for row in poll_list %}
( id:{{ row.id }} ) - {{ row.rosword }}
{% endfor %}

{% else %}
No list is available.
{% endif %}








{% for choice in poll_list %}

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d8f21d91-e06d-428d-923d-08ace9d8df8a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Vancouver Python Day - Talk Proposal Deadline

2013-10-14 Thread Andy McKay
Hi Djangonauts!

We've just set the deadline for Vancouver Python Day talk proposal
submissions. All talk proposals must be submitted by *Thursday, October 17,
2013 at 23:59 Pacific Time*. See
https://github.com/andymckay/vancouver-python-day for instructions on
submitting a talk proposal. All Python-related topics are welcome --
including Django!

In case you haven't heard, *Vancouver Python Day* is a one-day mini
conference celebrating the Python Developer Community in Vancouver. It will
be held on *Saturday, November 16, 2013* at SFU Harbour Centre. Stay tuned
for another announcement soon regarding ticket availability. In the
meantime, mark your calendar!

Andy

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8a10jJiwLctOrGSOwCzNZWPN6gNe-%2BFK34tw2d2dkSvWA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Software Foundation minutes

2013-10-14 Thread Andy McKay
Just wanted to make people aware that each month the board of the Django
Software Foundation meets. The minutes of each meeting are published here:

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

If there's anything you'd like discussed at the next board meeting, please
contact us at:

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

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOjXX8YiyMUT5ROusPPJNW%2BWpMZ7YFuNRZ30ccBH6WRNYz8rvw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Darion Yaphet
ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv


2013/10/14 Leonardo Giordani 

> Please give me the information I asked you, otherwise I cannot figure out
> what kind of problem you have.
>
> Are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on?
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>>  Python  2.7.3 and Django is 1.5.3 ..
>>
>>
>> 2013/10/14 Leonardo Giordani 
>>
>>> Hi, are you using a virtualenv? In that case, can you post the list of
>>> packages you installed? If not, can you give details about the OS you are
>>> working on, Django version, and so on?
>>>
>>> Regards,
>>>
>>> Leo
>>>
>>> Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/14 Darion Yaphet 
>>>
 Hi all :

 when I use django-admin.py to init django project
 django-admin.py  startproject hello

 Got a exception ..
  AttributeError: 'module' object has no attribute '_handlerList'

 what is it 

 --
 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.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
 .
 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
>>> .
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>>
>>
>>
>> long is the way and hard  that out of Hell leads up to light
>>
>>  --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com
>> .
>>
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3D-D_WzBa4_Lis4Bppak-czSKG9D60b91b7GFSWvnWM%2Bw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 


long is the way and hard  that out of Hell leads up to light

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOHWcCLGk_MTSTd%2BLXPdu90kYva%3D5v2Gmgp85QxGtU%2BE4EH%2B8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
On 14 October 2013 17:06, Tom Evans  wrote:

> On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa  wrote:
> > I can't get logging in with alternate auth backends to work with Django
> 1.4
> > or newer.
>


> Are you sure sessions are working correctly? Are you setting cookies
> (for session or otherwise) with a different host name than you are
> serving from?
>
> Thx for the suggestion. With 1.3.1, a secure sessionid and and a csrf
token is set. With 1.5.4. the secure session id is also httponly, and the
csrftoken is also set. That's the only difference cookie-wise. I think I'll
dump the contents of the sessions to see what's going on.


HM

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrrfhybFuTJt4qgB-8OyxEnx2qZW%3DQVFzrW5Aqs8nrpxAWw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


We are hiring!

2013-10-14 Thread Team UK
Independent freelance Django developers. 2 years minimum experience 
 required in Django/python, CSS, HTML5, Bootstrap and JS backbone.

Please email your CV.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93d68be5-a3e4-4de7-93b5-162ded47b2da%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Leonardo Giordani
Ok, can you please try to traceback the command and post the results?

python django-admin.py startproject hello --traceback



Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/15 Darion Yaphet 

> ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv
>
>
> 2013/10/14 Leonardo Giordani 
>
>> Please give me the information I asked you, otherwise I cannot figure out
>> what kind of problem you have.
>>
>> Are you using a virtualenv? In that case, can you post the list of
>> packages you installed? If not, can you give details about the OS you are
>> working on?
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/14 Darion Yaphet 
>>
>>>  Python  2.7.3 and Django is 1.5.3 ..
>>>
>>>
>>> 2013/10/14 Leonardo Giordani 
>>>
 Hi, are you using a virtualenv? In that case, can you post the list of
 packages you installed? If not, can you give details about the OS you are
 working on, Django version, and so on?

 Regards,

 Leo

 Leonardo Giordani
 Author of The Digital Cat 
 My profile on About.me  - My GitHub
 page  - My Coderwall 
 profile


 2013/10/14 Darion Yaphet 

> Hi all :
>
> when I use django-admin.py to init django project
> django-admin.py  startproject hello
>
> Got a exception ..
>  AttributeError: 'module' object has no attribute '_handlerList'
>
> what is it 
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
> .
> 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.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>> long is the way and hard  that out of Hell leads up to light
>>>
>>>  --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com
>>> .
>>>
>>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3D-D_WzBa4_Lis4Bppak-czSKG9D60b91b7GFSWvnWM%2Bw%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
>
>
> long is the way and hard  that out of Hell leads up to light
>
>  --
> 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

Re: def altword_list(self, request, word_id):

2013-10-14 Thread Leonardo Giordani
Can you check the code you posted? The get_query() function is empty so
this code, as posted, can not run.
Please post even the urls you are using to call the view.

Cheers,

Leo

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/15 Pepsodent Cola 

> Hi,
>
> I got some help by somebody on #django IRC.  They gave me this code
> snippet to fix my problem.  But I'm having problems incorporating that code
> into my Class file because Template file says "No list is available" when I
> try to access the list variable.  What am I doing wrong?
>
> # Filter 8
> def altword_list(self, request, word_id):
> #object_list =
> AltWord.objects.filter(word__pk=word_id).order_by('-votes')
> object_list =
> Altword.objects.filter(word__pk=word_id).order_by('-votes')
>
> return render(request, 'navi_polls/altword_list.html', {
> 'poll_list': object_list,
> })
>
>
>
> *Views*
>
> #___
>
> class AltwordlistView(generic.DetailView):
> #model = Word
> model = Altword
> template_name = 'navi_polls/altword_list.html'
> context_object_name = 'poll'
>
> def get_queryset(self):
> # Filter 5
> #return Word.objects.filter(direct_transl_word='')
>
>
> def get_context_data(self, **kwargs):
> context = super(AltwordlistView, self).get_context_data(**kwargs)
> # Filter 4b
> filter_4b =
> Altword.objects.filter(rosword__direct_transl_word='').order_by('-votes')
> # Filter 7
> filter_7 = Altword.objects.vote_order()
> # Filter 8b
> #filter_8b =
> Altword.objects.filter(word__pk=word_id).order_by('-votes')
>
>
> context.update({
> "filter_4b": filter_4b,
> "filter_7": filter_7
>  #   "filter_8b": filter_8b
> })
> return context
>
>
> # Filter 8
> def altword_list(self, request, word_id):
> #object_list =
> AltWord.objects.filter(word__pk=word_id).order_by('-votes')
> object_list =
> Altword.objects.filter(word__pk=word_id).order_by('-votes')
>
> return render(request, 'navi_polls/altword_list.html', {
> 'poll_list': object_list,
> })
>
> #___
> *
> *
>
>
> *Template*
>
> #___
>
> 
> {% if poll_list %}
> 
> {% for row in poll_list %}
> ( id:{{ row.id }} ) - {{ row.rosword }}
> {% endfor %}
> 
> {% else %}
> No list is available.
> {% endif %}
>
>
> 
> 
> 
>
> 
> 
> {% for choice in poll_list %}
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d8f21d91-e06d-428d-923d-08ace9d8df8a%40googlegroups.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOmK17x_ZVqcFxpOMBGqQ7qTzjhFPD233r94qyQU9i9kbg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.