Re: Pls help me

2013-05-14 Thread Sergiy Khohlov
Could you please clarify your question ?
 What do you want to do ?
 I dont have mind control skill

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Tue, May 14, 2013 at 10:33 AM, Nathaniel wrote:

> Hi guys. What is wrong with my codes below?
>
> class EmailChangeForm(forms.ModelForm):
> new_email1 = forms.CharField(label = _("Type new Email"))
> new_email2 = forms.CharField(label = _("Type Email again"))
>
> def __init__(self, user, *args, **kwargs):
> self.user = user
>
> def clean_new_email2(self):
> email1 = self.cleaned_data.get('new_email1')
> email2 = self.cleaned_data.get('new_email2')
> if email1 and email2:
> if email1 != email2:
> raise forms.ValidationError(
> self.error_messages['password_mismatch'])
> return email2
>
> def save(self, commit=True):
> user = super(EmailChangeForm, self).save(commit=False)
> user.email = self.cleaned_data["email1"]
> if commit:
> user.save()
> return 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.
>
>
>

-- 
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: Pls help me

2013-05-14 Thread Nathaniel
Hi. Upon login, user can go to email_change_form.html to update their email 
address. They will enter their new email twice to update their profile.
Actually, a change email confirmation would be perfect.

On Tuesday, May 14, 2013 3:33:41 PM UTC+8, Nathaniel wrote:
>
> Hi guys. What is wrong with my codes below?
>
> class EmailChangeForm(forms.ModelForm):
> new_email1 = forms.CharField(label = _("Type new Email"))
> new_email2 = forms.CharField(label = _("Type Email again"))
>
> def __init__(self, user, *args, **kwargs):
> self.user = user
>
> def clean_new_email2(self):
> email1 = self.cleaned_data.get('new_email1')
> email2 = self.cleaned_data.get('new_email2')
> if email1 and email2:
> if email1 != email2:
> raise forms.ValidationError(
> self.error_messages['password_mismatch'])
> return email2
> 
> def save(self, commit=True):
> user = super(EmailChangeForm, self).save(commit=False)
> user.email = self.cleaned_data["email1"]
> if commit:
> user.save()
> return 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: Pls help me

2013-05-14 Thread Sergiy Khohlov
Post your models, views, forms and sometimes a template

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Tue, May 14, 2013 at 11:18 AM, Nathaniel wrote:

> Hi. Upon login, user can go to email_change_form.html to update their
> email address. They will enter their new email twice to update their
> profile.
> Actually, a change email confirmation would be perfect.
>
>
> On Tuesday, May 14, 2013 3:33:41 PM UTC+8, Nathaniel wrote:
>>
>> Hi guys. What is wrong with my codes below?
>>
>> class EmailChangeForm(forms.**ModelForm):
>> new_email1 = forms.CharField(label = _("Type new Email"))
>> new_email2 = forms.CharField(label = _("Type Email again"))
>>
>> def __init__(self, user, *args, **kwargs):
>> self.user = user
>>
>> def clean_new_email2(self):
>> email1 = self.cleaned_data.get('new_**email1')
>> email2 = self.cleaned_data.get('new_**email2')
>> if email1 and email2:
>> if email1 != email2:
>> raise forms.ValidationError(
>> self.error_messages['password_**mismatch'])
>> return email2
>>
>> def save(self, commit=True):
>> user = super(EmailChangeForm, self).save(commit=False)
>> user.email = self.cleaned_data["email1"]
>> if commit:
>> user.save()
>> return 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.
>
>
>

-- 
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: Pls help me

2013-05-15 Thread Nat
My codes below do not work, please help me correct them... Thanks in advance

urlpatterns = patterns('symphony.accounts.views',
(r'^email/change/$', 'email_change'),
url(r'^email/change/done/$', direct_to_template,
{'template': 'registration/email_change_done.html'}, 
name="email_change_done"),
url(r'^email/change/error/$', direct_to_template,
{'template': 'registration/email_change_error.html'}, 
name="email_change_error"),)

FORMS.PY
class EmailChangeForm(forms.Form):
error_messages = {
'email_mismatch': _("The two email fields didn't match."),
}
new_email1 = forms.CharField(label=_("Type new Email"))
new_email2 = forms.CharField(label=_("Type Email again"))

def __init__(self, user, *args, **kwargs):
self.user = user
super(EmailChangeForm, self).__init__(*args, **kwargs)

def clean_new_email2(self):
email1 = self.cleaned_data.get('new_email1')
email2 = self.cleaned_data.get('new_email2')
if email1 and email2:
if email1 != email2:
raise forms.ValidationError(
self.error_messages['email_mismatch'])
return email2

def save(self, commit=True):
self.user.email=(self.cleaned_data['new_email1'])
if commit:
self.user.save()
return self.user

VIEWS.PY
def email_change(request, 
template_name='registration/email_change_form.html',
email_change_form=EmailChangeForm, success_url='email_change_done', 
error_url='email_change_error'):
user = User.objects.using('default').get(email=request.user.email)
 if request.method == "POST":
form = email_change_form(user=user, data=request.POST)
 if form.is_valid():
form.save()
return redirect(success_url)
else:
form = email_change_form(user=user)
return render_to_response(template_name, {
'form': form, }, context_instance=RequestContext(request))
except User.DoesNotExist:
return redirect(error_url)

On Tuesday, May 14, 2013 4:38:48 PM UTC+8, Sergiy Khohlov wrote:
>
> Post your models, views, forms and sometimes a template 
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Tue, May 14, 2013 at 11:18 AM, Nathaniel 
> > wrote:
>
>> Hi. Upon login, user can go to email_change_form.html to update their 
>> email address. They will enter their new email twice to update their 
>> profile.
>> Actually, a change email confirmation would be perfect.
>>
>>
>> On Tuesday, May 14, 2013 3:33:41 PM UTC+8, Nathaniel wrote:
>>>
>>> Hi guys. What is wrong with my codes below?
>>>
>>> class EmailChangeForm(forms.**ModelForm):
>>> new_email1 = forms.CharField(label = _("Type new Email"))
>>> new_email2 = forms.CharField(label = _("Type Email again"))
>>>
>>> def __init__(self, user, *args, **kwargs):
>>> self.user = user
>>>
>>> def clean_new_email2(self):
>>> email1 = self.cleaned_data.get('new_**email1')
>>> email2 = self.cleaned_data.get('new_**email2')
>>> if email1 and email2:
>>> if email1 != email2:
>>> raise forms.ValidationError(
>>> self.error_messages['password_**mismatch'])
>>> return email2
>>> 
>>> def save(self, commit=True):
>>> user = super(EmailChangeForm, self).save(commit=False)
>>> user.email = self.cleaned_data["email1"]
>>> if commit:
>>> user.save()
>>> return 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...@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: Pls help me

2013-05-15 Thread Daniel Roseman
On Wednesday, 15 May 2013 10:58:32 UTC+1, Nat wrote:

> My codes below do not work, please help me correct them... Thanks in 
> advance
>
>>
>>
No. You haven't said what does not "work". What happens? What doesn't 
happen? What errors do you get? Be specific.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pls help me

2013-05-15 Thread Roberto López López
To begin with, CharField needs a max_length parameter.



On 05/15/2013 11:58 AM, Nat wrote:
> My codes below do not work, please help me correct them... Thanks in
> advance
>
> urlpatterns = patterns('symphony.accounts.views',
> (r'^email/change/$', 'email_change'),
> url(r'^email/change/done/$', direct_to_template,
> {'template': 'registration/email_change_done.html'},
> name="email_change_done"),
> url(r'^email/change/error/$', direct_to_template,
> {'template': 'registration/email_change_error.html'},
> name="email_change_error"),)
>
> FORMS.PY
> class EmailChangeForm(forms.Form):
> error_messages = {
> 'email_mismatch': _("The two email fields didn't match."),
> }
> new_email1 = forms.CharField(label=_("Type new Email"))
> new_email2 = forms.CharField(label=_("Type Email again"))
>
> def __init__(self, user, *args, **kwargs):
> self.user = user
> super(EmailChangeForm, self).__init__(*args, **kwargs)
>
> def clean_new_email2(self):
> email1 = self.cleaned_data.get('new_email1')
> email2 = self.cleaned_data.get('new_email2')
> if email1 and email2:
> if email1 != email2:
> raise forms.ValidationError(
> self.error_messages['email_mismatch'])
> return email2
> 
> def save(self, commit=True):
> self.user.email=(self.cleaned_data['new_email1'])
> if commit:
> self.user.save()
> return self.user
>
> VIEWS.PY
> def email_change(request,
> template_name='registration/email_change_form.html',
> email_change_form=EmailChangeForm, success_url='email_change_done',
> error_url='email_change_error'):
> user = User.objects.using('default').get(email=request.user.email)
>  if request.method == "POST":
> form = email_change_form(user=user, data=request.POST)
>  if form.is_valid():
> form.save()
> return redirect(success_url)
> else:
> form = email_change_form(user=user)
> return render_to_response(template_name, {
> 'form': form, }, context_instance=RequestContext(request))
> except User.DoesNotExist:
> return redirect(error_url)
>
> On Tuesday, May 14, 2013 4:38:48 PM UTC+8, Sergiy Khohlov wrote:
>
> Post your models, views, forms and sometimes a template 
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Tue, May 14, 2013 at 11:18 AM, Nathaniel  > wrote:
>
> Hi. Upon login, user can go to email_change_form.html to
> update their email address. They will enter their new email
> twice to update their profile.
> Actually, a change email confirmation would be perfect.
>
>
> On Tuesday, May 14, 2013 3:33:41 PM UTC+8, Nathaniel wrote:
>
> Hi guys. What is wrong with my codes below?
>
> class EmailChangeForm(forms.ModelForm):
> new_email1 = forms.CharField(label = _("Type new Email"))
> new_email2 = forms.CharField(label = _("Type Email
> again"))
>
> def __init__(self, user, *args, **kwargs):
> self.user = user
>
> def clean_new_email2(self):
> email1 = self.cleaned_data.get('new_email1')
> email2 = self.cleaned_data.get('new_email2')
> if email1 and email2:
> if email1 != email2:
> raise forms.ValidationError(
> self.error_messages['password_mismatch'])
> return email2
> 
> def save(self, commit=True):
> user = super(EmailChangeForm, self).save(commit=False)
> user.email = self.cleaned_data["email1"]
> if commit:
> user.save()
> return 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...@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@goo

Re: Pls help me to solve this error.

2012-07-13 Thread Sergiy Khohlov
paste your url.py and model.py

2012/7/13 mickey :
> I had uploaded image of error.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/4QFMHRLMN58J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Pls help me to solve this error.

2012-07-14 Thread mickey


On Friday, July 13, 2012 6:03:09 PM UTC+5:30, skhohlov wrote:
>
> paste your url.py and model.py 
>
> 2012/7/13 mickey : 
> > I had uploaded image of error. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/django-users/-/4QFMHRLMN58J. 
> > To post to this group, send email to django-users@googlegroups.com. 
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com. 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BKnJMUgdL24J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField()from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
url(r'^polls/$', 'polls.views.index'),
url(r'^polls/(?P\d+)/$', 'polls.views.detail'),
url(r'^polls/(?P\d+)/results/$', 'polls.views.results'),
url(r'^polls/(?P\d+)/vote/$', 'polls.views.vote'),
url(r'^admin/', include(admin.site.urls)),
)


Re: PLS Help Me in Securing Project - Application on PythonAnyWhere hosted

2019-09-05 Thread Rahul Roshan
You can go through below links:

https://docs.djangoproject.com/en/2.2/topics/security/
https://opensource.com/article/18/1/10-tips-making-django-admin-more-secure
https://coffeeonthekeyboard.com/best-basic-security-practices-especially-with-django-697/
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/web_application_security


Thanks,
Rahul

On Thu, Sep 5, 2019 at 8:27 AM Balaji Shetty  wrote:

> Hello Every one
>
> I am new to Django.  I have been working from 4 to 5 months only.
> I have deployed the real time Project on PythonAnywhere.
> Client is using this now.
>
> My Basic question is
>
> How to Secure our Project. What are the Preventive Steps We must take
> before deployment of Project.
>
> Some measures considered here are
> I have made DEBUG = False
> Secret Key
> Hash Password
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECSbOudUftPApPoAFDmtANRXP%2BeZ24%3DOcX%2BvQ1SenyTGwm0fQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN%2BO0S4Uh3Vnij-OcVPdgkUbW86Tm3%2B-nNO26T48i4_fB%3D%2Bq3w%40mail.gmail.com.