Re: How to use modpython in django version 1.5

2013-11-25 Thread Daniel Roseman


On Monday, 25 November 2013 06:01:35 UTC, Russell Keith-Magee wrote:
>
>
> On Mon, Nov 25, 2013 at 1:39 PM, nobody  >wrote:
>
>> Hi,
>>
>> After version 1.5, django has disabled mod_python. Can we still use the 
>> modpython instead of mod_wsgi? If so, how can we install the mod_python, 
>> doesn't seem a package is available in Debian squeeze or wheezy.
>>
>
> No, you can't. The reason Django removed support for mod_python is because 
> mod_python is an unmaintained project - and that's coming direct from the 
> maintainers of mod_python. That means it isn't getting bug fixes, nobody is 
> looking after security issues, or memory leaks, or fixing any of the myriad 
> problems that mod_python had (including, but not limited to, a lack of 
> support for Python 3). 
>
> This isn't a recent change, either. The Apache project moved mod_python 
> into the "attic" on 16 Jun 2010. That's 3.5 years ago.
>
> Seriously - there's no reason to be using mod_python these days. You 
> should be using a container based on WSGI -- mod_wsgi if you want to stick 
> with Apache, or any of the other excellent WSGI containers (e.g., gunicorn).
>
> Yours,
> Russ Magee %-)
>
>
No longer quite true. The original developer of mod_python, grisha, has 
restarted work on it: 
see http://grisha.org/blog/2013/10/25/mod-python-the-long-story/
However as he explains in that post, he doesn't really see it as a means of 
running websites, but rather as a Python interface to Apache. So you're 
still right that mod_wsgi remains the best bet.
--
DR.

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


Re: Form cleaned_data

2013-11-25 Thread Daniel Roseman
On Sunday, 24 November 2013 18:46:21 UTC, Timothy W. Cook wrote:
>
> On Sun, Nov 24, 2013 at 4:38 PM, Daniel Roseman 
> > 
> wrote: 
> > Hmm, I tried to post an answer to your original question earlier but it 
> never appeared. 
> > 
>
> Thanks Daniel.  Your help is very much appreciated. 
>
> > The reason why adding the values to `cleaned_data` doesn't work is that 
> those fields aren't in the `fields` list for the form in the first place, 
> so it doesn't know to do anything with them. Adding them to the uncommitted 
> model instance is the correct solution. 
> > -- 
>
> I guess I was thinking that cleaned_data is a dictionary sent to the 
> ORM for commit? 
>

Well, not really, it only takes account of those fields that are in 
Meta.fields (and not in Meta.exclude).
 

> Now, what is confusing is why saving the 'form' instance to another 
> (in this case 'f') instance without a commit and adding the values to 
> the new instance makes a difference.  Isn't 'f' just a copy of 'form'? 
>
> Any clarification?
>

No, `f` is now an unsaved instance of the Review model, rather than a form 
(you should probably make that clearer by calling the instance `r` or 
`review`). So you can modify it like you would any other model instance 
before calling save() - and of course this is the normal model save(), not 
the form's.
--
DR.

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


Re: Form cleaned_data

2013-11-25 Thread Timothy W. Cook
On Mon, Nov 25, 2013 at 8:22 AM, Daniel Roseman  wrote:
> On Sunday, 24 November 2013 18:46:21 UTC, Timothy W. Cook wrote:
>>
>> On Sun, Nov 24, 2013 at 4:38 PM, Daniel Roseman 
>> wrote:

>
> No, `f` is now an unsaved instance of the Review model, rather than a form
> (you should probably make that clearer by calling the instance `r` or
> `review`).

I will certainly call it something else now that I realize:
f = form.save(commit=False)
means to make a copy of the model without saving it to disk.  I
previously (from the SO example) thought I was making a copy of he
form.

IT still isn't clear how form.save yeailds a copy of the model and not
a copy of the form.

> So you can modify it like you would any other model instance
> before calling save() - and of course this is the normal model save(), not
> the form's.

So the follow on to that is how (if 'f' is a model instance) does the
form data get into my model instance.  I am sure that there is
somewhere in the docs or at least in the code that this can be seen?

Thanks,
Tim



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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/CA%2B%3DOU3Xpw2M_kLrruEU5SqhrT7wxn5sYrz_KS0CKuLtmFkUNug%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Filtering by month doesn't work

2013-11-25 Thread Vojtěch Tranta
Hi,
do you have any clue why this does not work?

def index(request):
if request.method == 'POST' and request.POST:
event_form = EventForm(request.POST)
event = event_form.save()

today = datetime.date.today();
year = int(today.strftime('%Y'))
month = int(today.strftime('%m'))
events = Event.objects.filter(end__month='11')
# events = Event.objects.all()
pdb.set_trace()
cal = jvccalendar.HTMLCalendar(jvccalendar.MONDAY).formatmonth(year, month, 
events)
form = EventForm()
return render_to_response('jvc/index.html', {'cal': cal, 'side_form': 
form}, context_instance=RequestContext(request))


I am still getting "events" as empty, filtering using 
filter(end_start='2013') works, but filtering by month does not, I googled 
as much as I could, but no luck. I copied code from StackOverflow, but no 
luck 
Thank you!

-- 
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/a4f92f8f-710d-4a19-b869-3a93681557fc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Filtering by month doesn't work

2013-11-25 Thread Начаров Михаил
Hi Tranta.
In my projects this functionality works fine. 
What version of django did you used? 
Do you sure that field end in Event table contains November dates?

Also, you can use *today.month* instead of  *int(today.strftime('%m')*) and* 
today.year *instead of  *int(today.strftime('%Y')).*
And in django docs says that it necessary to validate your form before use 
it:

*if event_form.is_valid():*
*event = event_form.save()*


вторник, 26 ноября 2013 г., 5:24:21 UTC+6 пользователь Vojtěch Tranta 
написал:
>
> Hi,
> do you have any clue why this does not work?
>
> def index(request):
> if request.method == 'POST' and request.POST:
> event_form = EventForm(request.POST)
> event = event_form.save()
>
> today = datetime.date.today();
> year = int(today.strftime('%Y'))
> month = int(today.strftime('%m'))
> events = Event.objects.filter(end__month='11')
> # events = Event.objects.all()
> pdb.set_trace()
> cal = jvccalendar.HTMLCalendar(jvccalendar.MONDAY).formatmonth(year, 
> month, events)
> form = EventForm()
> return render_to_response('jvc/index.html', {'cal': cal, 'side_form': 
> form}, context_instance=RequestContext(request))
>
>
> I am still getting "events" as empty, filtering using 
> filter(end_start='2013') works, but filtering by month does not, I googled 
> as much as I could, but no luck. I copied code from StackOverflow, but no 
> luck 
> Thank you!
>

-- 
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/4521ed83-d85b-42a5-a344-27ac273648b9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to fix URL link redirecting from login?

2013-11-25 Thread nobody
Thanks for your advice and all responses, that works well.

Kind regards.

On Monday, November 25, 2013 12:14:23 AM UTC+11, Vibhu Rishi wrote:
>
> Its the @login_required decorator. 
> https://docs.djangoproject.com/en/1.2/topics/auth/#the-login-required-decorator
>
> V.
>
>
> On Sun, Nov 24, 2013 at 3:46 PM, Timothy W. Cook 
> > wrote:
>
>> Check in the docs for the instructions on decorating your views to
>> restrict to authenticated users.  This also talks about redirecting to
>> a page instructing them to login.  Sorry, I don't have the link
>> available right now.
>>
>>
>> On Sat, Nov 23, 2013 at 10:40 PM, nobody > 
>> wrote:
>> > Hi,
>> >
>> > I made an URL link in an email, if I have logged into the web site, 
>> then I
>> > can click the link, it would bring to a valid web page. But if I haven't
>> > logged log in, to click the link would result an error "page not 
>> found". How
>> > can I fix it to check if a user has not logged in, it opens a log page 
>> to
>> > ask the user to log in rather than an error page, after the user loges 
>> in,
>> > it would redirect to the link URL page?
>> >
>> > Thank you.
>> >
>> > Kind regards.
>> >
>> >
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an
>> > email to django-users...@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/ff130970-c4d4-4a96-8748-d386217b9cf5%40googlegroups.com
>> .
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>> --
>> MLHIM VIP Signup: http://goo.gl/22B0U
>> 
>> Timothy Cook, MSc   +55 21 94711995
>> MLHIM 
>> http://www.mlhim.org
>> Like Us on FB: 
>> https://www.facebook.com/mlhim2
>> Circle us on G+: http://goo.gl/44EV5
>> Google Scholar: http://goo.gl/MMZ1o
>> LinkedIn 
>> Profile:http://www.linkedin.com/in/timothywaynecook
>>
>> --
>> 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/CA%2B%3DOU3WJCAEwgGzvgnH1bH%3DpxtQ%3DWEGO%3DZcJHaWKXz%2BT2863Tw%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius 
>

-- 
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/8e4fe6be-292a-49bd-9835-093dc8330e4d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Filtering by month doesn't work

2013-11-25 Thread Leonardo Giordani
May you please post your Event model?

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


2013/11/26 Начаров Михаил 

> Hi Tranta.
> In my projects this functionality works fine.
> What version of django did you used?
> Do you sure that field end in Event table contains November dates?
>
> Also, you can use *today.month* instead of  *int(today.strftime('%m')*)
> and* today.year *instead of  *int(today.strftime('%Y')).*
> And in django docs says that it necessary to validate your form before use
> it:
>
> *if event_form.is_valid():*
> *event = event_form.save()*
>
>
> вторник, 26 ноября 2013 г., 5:24:21 UTC+6 пользователь Vojtěch Tranta
> написал:
>
>> Hi,
>> do you have any clue why this does not work?
>>
>> def index(request):
>> if request.method == 'POST' and request.POST:
>> event_form = EventForm(request.POST)
>> event = event_form.save()
>>
>> today = datetime.date.today();
>> year = int(today.strftime('%Y'))
>> month = int(today.strftime('%m'))
>> events = Event.objects.filter(end__month='11')
>> # events = Event.objects.all()
>> pdb.set_trace()
>> cal = jvccalendar.HTMLCalendar(jvccalendar.MONDAY).formatmonth(year,
>> month, events)
>> form = EventForm()
>> return render_to_response('jvc/index.html', {'cal': cal, 'side_form':
>> form}, context_instance=RequestContext(request))
>>
>>
>> I am still getting "events" as empty, filtering using
>> filter(end_start='2013') works, but filtering by month does not, I googled
>> as much as I could, but no luck. I copied code from StackOverflow, but no
>> luck
>> Thank you!
>>
>  --
> 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/4521ed83-d85b-42a5-a344-27ac273648b9%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%2BOmKTMpq8x%3DpZSHqrSDa_HS3z%2BYhaz%2BVsa1JZ9%3DFpOrPYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.