Re: placing views and models in configuration root

2014-04-27 Thread Andreas Bloch

>
> lrighty then - I will create an app then... 

-- 
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/0564a934-b2a9-4eda-b78c-646dca7b838a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: placing views and models in configuration root

2014-04-27 Thread Venkatraman S
On Mon, Apr 28, 2014 at 11:57 AM, Andreas Bloch  wrote:

> is it bad practice to create a views.py and models.py file and place it in
> the configuration root? (the folder that is created when you run
> "startproject " which contains the settings, urls, and uwsgi
> file")
>

An unequivocal 'Yes' :)

For more : www.slideshare.net/jacobian/the-best-and-worst-of-django

-V

-- 
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/CAN7tdFQnaHEbHOMxYO3tW6%3D2oJvF9y3ZhgttrN4o51ZP4OsyJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


placing views and models in configuration root

2014-04-27 Thread Andreas Bloch
is it bad practice to create a views.py and models.py file and place it in 
the configuration root? (the folder that is created when you run 
"startproject " which contains the settings, urls, and uwsgi 
file")

-- 
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/b5234a49-6e46-4c27-9322-9eb204999104%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django ユーザー登録について

2014-04-27 Thread Joseph Mutumi
Hi there, I think your problem is you have not initialized attendance
that you use at `instance = attendance`. So it is just using the name
of your view function which also happens to be 'attendance' and
showing you that error.

Initialize to model object with the usual:
Attendence_data.objects.get(pk=user_id) or if you are using
djago.shortcuts: get_object_or_404(Attendence_data, pk=user_id)

On 4/28/14, hito koto  wrote:
> Ok, Thank you!
>
> this is my models.py:
>
>
> from django.db import models
> from django.contrib.auth.models import User
> #from owner.models import GroupSchedule
>
>
>
> class GroupRestrictionMixin(object):
> group_field = 'group'
>
> def dispatch(request, *args, **kwargs):
> self.request = request
> self.args = args
> self.kwargs = kwargs
>
> obj_group = getattr(self.get_object(), self.group_field)
> user_groups = request.user.groups
>
> if obj_group not in user_groups:
> raise PermissionDenied
>
> return super(GroupRestrictionMixin, self).dispatch(request, *args,
> **kwargs)
>
>
> class User(models.Model):
> user_name = models.CharField(max_length=255, help_text="氏名(名)")
> first_kana = models.CharField(max_length=255, help_text="ふりがな(性)")
> last_kana  = models.CharField(max_length=255, help_text="ふりがな(名)")
> employee_number = models.CharField(blank=True, max_length=22,
> help_text="社員番号")
> gender = models.CharField(max_length=6, choices=(('male',
> '男性'),('female', '女性')), help_text="性別" )
> created_at = models.DateTimeField(auto_now_add=True, help_text="登録日")
>
>
> class Attendance_data(models.Model):
> user = models.ForeignKey(User)
> user_name = models.CharField(max_length=255, help_text="氏名(名)")
> employee_number = models.CharField(blank=True, max_length=22,
> help_text="社員番号")
>
> def __unicode__(self):
> return self.user_name, employee_number
>
> class Leave_work(models.Model):
> user = models.ForeignKey(User)
> user_name = models.CharField(max_length=255, help_text="氏名(名)")
> employee_number = models.CharField(blank=True, max_length=22,
> help_text="社員番号")
>
> def __unicode__(self):
> return self.user_name, employee_unmber
>
> this is my Views.py:
>
> def staff_data(request, user_id=1):
> user = get_object_or_404(User, pk=user_id)
> return render_to_response("staff_data.html",
>  {"user": User.objects.get(id=user_id) })
>
> def attendance(request, user_id):
> if request.method == "POST":
>
> form = Attendance_dataForm(request.POST, instance = attendance)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('/articles/get/%s' % user.id)
> else:
> form = Attendance_dataForm()
> args = {}
> args.update(csrf(request))
> args['form'] = form
> return render_to_response('staff_data.html', args,  context_instance =
> RequestContext(request, {'form': form}))
>
> def leave_work(request, user_id):
> if request.method == "POST":
> form = Leave_workForm(request.POST, instance = leave_work)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('/articles/get/%s' % user.id)
> else:
> form = Leave_workForm()
> c = {}
> c.update(csrf(request))
> c['form'] = form
> return render_to_response('staff_data.html', c,  context_instance =
> RequestContext(request, { 'form': form}))
>
> this is my forms.py:
>
> class ArticleForm(forms.ModelForm):
>
> class Meta:
> model = User
> fields = ('user_name','first_kana', 'last_kana',
> 'employee_number','birthday')
> user_name = forms.CharField(label="氏名", error_messages={'required':
> ''}, help_text='必須')
> first_kana =
> forms.CharField(label="ふりがな(性)",error_messages={'required': ''},
> help_text='必須')
> last_kana = forms.CharField(label="ふりがな(名)",error_messages={'required':
>
> ''}, help_text='必須')
> employee_number = forms.CharField(label="社員番号", required=False)
> birthday = forms.CharField(label="生年月日", required=False)
>
> class Attendance_dataForm(forms.ModelForm):
>
> class Meta:
> model = Attendance_data
> fields = ('user_name','employee_number')
>
> user_name = forms.CharField(label="氏名", error_messages={'required':
> ''}, help_text='必須')
> employee_number =
> forms.CharField(label="社員番号",error_messages={'required': ''},
> help_text='必須')
>
> class Leave_workForm(forms.ModelForm):
>
> class Meta:
> model = Leave_work
> fields = ('user_name', 'employee_number')
> user_name = forms.CharField(label="氏名", error_messages={'required':
> ''}, help_text='必須')
> employee_number = forms.CharField(label="社員番号",
> error_messages={'required': ''}, help_text='必須')
>
> and this is my staff_data.html:
>
> 
> {% csrf_token %}
> 
> 
> 
>ttendance 
> 
>   
> 
> 
>
> 
> {% csrf_token %}
> 
>  type="

Re: [OT]Code Review As a Service

2014-04-27 Thread Venkatraman S
An old thread that I started and over the past few years, and I want to
offer Code-Review as a Service
to anyone  wants their code to be reviewed. I have a few cycles free and
want to slowly get back into this.

Am not too much worried about the payment, but am looking for enthusiastic
and honest people/team(s) :)

Please do get in touch with me in private to discuss more,  if it interests
you.

Regards,
Venkat


On Tue, Jan 25, 2011 at 3:12 PM, Venkatraman S  wrote:

> Hi,
>
> I was wondering whether there any freelancers/companies who offer
> code-review as a service.
> IMHO, a code review helps in almost all occasions, but the faced paced
> life seems to have
> put this in the back burner.
>
> Would like your code to be reviewed? If yes, what would be the ideal per
> hour rates that
> would not hurt your wallet?
>
> -Venkat
>

-- 
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/CAN7tdFTWQpmGk3py%2BFTuRyLtA0Ph91Mhpjow8Q5%2B8dZeV2gZ%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django ユーザー登録について

2014-04-27 Thread Lachlan Musicman
You need to provide more information: like the models, and the copy of the
"copy and paste view" output.


cheers
L.


On 28 April 2014 12:41, hito koto  wrote:

> Hi,
> I have this error , why?
>
>  Request Method: POST  Request URL: http://articles/attendance/11/  Django
> Version: 1.6.2  Exception Type: AttributeError  Exception Value:
>
> 'function' object has no attribute '_meta'
>
>  Exception Location: /usr/lib/python2.6/site-packages/django/forms/models.py
> in model_to_dict, line 124  Python Executable: /usr/bin/python  Python
> Version: 2.6.6  Python Path:
>
> ['/usr/lib/python2.6/site-packages/pip-1.5.2-py2.6.egg',
>  '/usr/lib64/python26.zip',
>  '/usr/lib64/python2.6',
>  '/usr/lib64/python2.6/plat-linux2',
>  '/usr/lib64/python2.6/lib-tk',
>  '/usr/lib64/python2.6/lib-old',
>  '/usr/lib64/python2.6/lib-dynload',
>  '/usr/lib64/python2.6/site-packages',
>  '/usr/lib/python2.6/site-packages',
>  '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
>  '/var/www/html/ihttest/ihttcs_test/kojin',
>  '/var/www/html/ihttest/ihttcs_test/kojin/static/']
>
>  Server time: Mon, 28 Apr 2014 11:19:29 +0900  Traceback Switch to
> copy-and-paste 
> view
>
>- /usr/lib/python2.6/site-packages/django/core/handlers/base.py in
>get_response
>1.
>
>   response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
>
>   ...
> ▶ Local 
> vars
>- /var/www/html/article/views.py in attendance
>1.
>
>   form = Attendance_dataForm(request.POST, instance = attendance)
>
>
> this is my Views.py:
> def attendance(request, user_id):
> if request.method == "POST":
>
> form = Attendance_dataForm(request.POST, instance = attendance)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('/articles/get/%s' % user.id)
> else:
> form = Attendance_dataForm()
>
> args = {}
> args.update(csrf(request))
> args['form'] = form
> return render_to_response('staff_data.html', args,  context_instance =
> RequestContext(request, {'form': form}))
> def leave_work(request, user_id):
> if request.method == "POST":
>  #   leave_work = Leave_work(user = request.user_id)
>
> form = Leave_workForm(request.POST, instance = leave_work)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('/articles/get/%s' % user.id)
> else:
> form = Leave_workForm()
> c = {}
> c.update(csrf(request))
> c['form'] = form
> return render_to_response('staff_data.html', c,  context_instance =
> RequestContext(request, { 'form': form}))
>
>
>
>
>
>
>
>
>
>
>
>
> 2014年4月24日木曜日 7時08分05秒 UTC+9 Lachlan Musicman:
>>
>>
>> On 23 April 2014 17:59, hito koto  wrote:
>>
>>> Thank you!
>>> i can do create!
>>>
>>> Sorry! i'm don't understand create staff site,
>>> i want to create  staff site , staff site should have when rogin using
>>> ID/PW and have staff profile
>>> i'm realy don't know!
>>>
>>> pleae help me
>>>
>>
>>
>>
>> So you need to create an URL that looks something like:
>>
>> https://URL/staff/staff_id
>>
>> And you want to redirect to that after login. This question has one
>> example of how to solve that problem:
>>
>> http://stackoverflow.com/questions/4870619/django-
>> after-login-redirect-user-to-his-custom-page-mysite-com-username
>>
>> cheers
>> L.
>>
>>
>>
>>
>>>
>>>
>>> 2014年4月23日水曜日 16時18分44秒 UTC+9 Lachlan Musicman:


 On 23 April 2014 14:11, hito koto  wrote:

> Thank you very much good idea!
> i'm was try but i'm have error when create new staff !
>
> >>Request Method: POST  >>Request URL: http://articles/create/  >>Django
> Version: 1.6.2  >>Exception Type: IntegrityError  >>Exception Value:
>
> (1048, "Column 'user_id' cannot be null")
>
>  >>Exception Location: /usr/lib64/python2.6/site-pack
> ages/MySQLdb/connections.py in defaulterrorhandler, line 36  >>Python
> Executable: /usr/bin/python
>  >>/var/www/html/article/views.py in create
>
>  >>   form.save()
>
> this is my views.py:
>
> def create(request):
> if request.POST:
> form = ArticleForm(request.POST)
> if form.is_valid():
> form.save()
>
> return HttpResponseRedirect('/articles/all')
>
> else:
> form = ArticleForm()
> args = {}
> args.update(csrf(request))
> args['form'] = form
> return render_to_response('create.html', args)
>
>
>
>

 I'm actually racing out the door, but quickly: the id field is
 automatic. Your form refers to a user_id field that doesn't exist on your
 model except as implied. In that case, you don't need to ask for user_id in

Re: Django ユーザー登録について

2014-04-27 Thread hito koto
Hi, 
I have this error , why?

 Request Method: POST  Request URL: http://articles/attendance/11/  Django 
Version: 1.6.2  Exception Type: AttributeError  Exception Value: 

'function' object has no attribute '_meta'

 Exception Location: /usr/lib/python2.6/site-packages/django/forms/models.py 
in model_to_dict, line 124  Python Executable: /usr/bin/python  Python 
Version: 2.6.6  Python Path: 

['/usr/lib/python2.6/site-packages/pip-1.5.2-py2.6.egg',
 '/usr/lib64/python26.zip',
 '/usr/lib64/python2.6',
 '/usr/lib64/python2.6/plat-linux2',
 '/usr/lib64/python2.6/lib-tk',
 '/usr/lib64/python2.6/lib-old',
 '/usr/lib64/python2.6/lib-dynload',
 '/usr/lib64/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
 '/var/www/html/ihttest/ihttcs_test/kojin',
 '/var/www/html/ihttest/ihttcs_test/kojin/static/']

 Server time: Mon, 28 Apr 2014 11:19:29 +0900  Traceback Switch to 
copy-and-paste 
view 
   
   - /usr/lib/python2.6/site-packages/django/core/handlers/base.py in 
   get_response 
   1. 
  
  response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
  
  ...
▶ Local 
vars 
   - /var/www/html/article/views.py in attendance 
   1. 
  
  form = Attendance_dataForm(request.POST, instance = attendance)
  
  
this is my Views.py:
def attendance(request, user_id):
if request.method == "POST":

form = Attendance_dataForm(request.POST, instance = attendance)
if form.is_valid():
form.save()
return HttpResponseRedirect('/articles/get/%s' % user.id)
else:
form = Attendance_dataForm()
args = {}
args.update(csrf(request))
args['form'] = form
return render_to_response('staff_data.html', args,  context_instance = 
RequestContext(request, {'form': form}))
def leave_work(request, user_id):
if request.method == "POST":
 #   leave_work = Leave_work(user = request.user_id)

form = Leave_workForm(request.POST, instance = leave_work)
if form.is_valid():
form.save()
return HttpResponseRedirect('/articles/get/%s' % user.id)
else:
form = Leave_workForm()
c = {}
c.update(csrf(request))
c['form'] = form
return render_to_response('staff_data.html', c,  context_instance = 
RequestContext(request, { 'form': form}))












2014年4月24日木曜日 7時08分05秒 UTC+9 Lachlan Musicman:
>
>
> On 23 April 2014 17:59, hito koto >wrote:
>
>> Thank you!
>> i can do create!
>>
>> Sorry! i'm don't understand create staff site,
>> i want to create  staff site , staff site should have when rogin using 
>> ID/PW and have staff profile
>> i'm realy don't know!
>>
>> pleae help me
>>
>
>
>
> So you need to create an URL that looks something like:
>
> https://URL/staff/staff_id
>
> And you want to redirect to that after login. This question has one 
> example of how to solve that problem:
>
>
> http://stackoverflow.com/questions/4870619/django-after-login-redirect-user-to-his-custom-page-mysite-com-username
>  
>
> cheers
> L.
>
>
>  
>
>>
>>
>> 2014年4月23日水曜日 16時18分44秒 UTC+9 Lachlan Musicman:
>>>
>>>
>>> On 23 April 2014 14:11, hito koto  wrote:
>>>
 Thank you very much good idea!
 i'm was try but i'm have error when create new staff !

 >>Request Method: POST  >>Request URL: http://articles/create/  >>Django 
 Version: 1.6.2  >>Exception Type: IntegrityError  >>Exception Value: 

 (1048, "Column 'user_id' cannot be null")

  >>Exception Location: /usr/lib64/python2.6/site-
 packages/MySQLdb/connections.py in defaulterrorhandler, line 36  >>Python 
 Executable: /usr/bin/python
  >>/var/www/html/article/views.py in create 

  >>   form.save()

 this is my views.py:

 def create(request):
 if request.POST:
 form = ArticleForm(request.POST)
 if form.is_valid():
 form.save()

 return HttpResponseRedirect('/articles/all')

 else:
 form = ArticleForm()
 args = {}
 args.update(csrf(request))
 args['form'] = form
 return render_to_response('create.html', args)




>>>
>>> I'm actually racing out the door, but quickly: the id field is 
>>> automatic. Your form refers to a user_id field that doesn't exist on your 
>>> model except as implied. In that case, you don't need to ask for user_id in 
>>> the form. If you want staff to have an ID_number, you should separate it 
>>> from the id (also known as the pk or primary key) field in the model class, 
>>> then query it in the form. 
>>>
>>> But as it stands, you can remove it from your form, and that should work.
>>>
>>> cheers
>>> L.
>>>
>>>
>>>
>>>  
>>>
  this is 

Django With Xampp and MySQL - Creating Tables, Models.py not working(Windows)

2014-04-27 Thread zanemcadams
I have tried out Django with the development server that comes with it - 
and I never had any issues. I decided to try it out with xampp as I'll be 
hosting my web app on a VPS soon. The problem I'm having is that whenever I 
try to use the syncdb command after creating a table in the models.py file, 
I get an error:

ImportError - No module named "my table/class name here".

I use python 2.7 in my PATH variable, I have django-admin.py in my xampp 
root folder, and I have successfully created a project and my first app 
with django-admin.py. But I can't interact with the database at all.


Models.py:
from django.db import models

# Create your models here.

class messagechat(models.Model):
username = models.CharField(max_length=150)
body = models.CharField(max_length=800)
score = models.DecimalField(max_digits=10)

settings.py:(database section only)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': dbnamehere',
'USER': 'userhere',
'PASSWORD': 'pswdhere',
'HOST': 'using local host',
'PORT': 'porthere', 
}

*Error Message I receive In command Prompt:*





Do I have any chance of figuring out what is wrong here?

-- 
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/dad472c0-c154-4e27-a355-89fb7b02743d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial - Customize the admin look and feel

2014-04-27 Thread m1chael
You really shouldn't be learning with the dev version as Babatunde
Akinyanmi pointed out, but, i'm curious enough to respond have you
tried to install Django toolbar to figure out what template is
actually being loaded? Maybe that will give you a good idea on where
to troubleshoot

Mike


On Sun, Apr 27, 2014 at 7:16 PM, Babatunde Akinyanmi
 wrote:
> This does not answer the question but you really shouldn't be learning with
> the dev version
>
> On 27 Apr 2014 15:38, "rob25"  wrote:
>>
>> Hello,
>>
>> I was following the instructions to create a basic poll application with
>> django 1.8 (dev), but now I'm stuck to this paragraph.
>> My template doesn't override the original.
>>
>> This is the instruction added at the end of 'settings.py':
>> TEMPLATES_DIRS = [os.path.join(BASE_DIR, 'templates')]
>>
>> This is my directory structure:
>> mysite/
>> mysite/
>> __init__.py
>> settings.py
>> urls.py
>> wsgi.py
>> polls/
>> templates/
>> admin/
>> base_site.html
>> db.sqlite3
>> manage.py
>>
>> In my 'base_site.html' I replaced '{{ site_header }}' with 'MySite', but I
>> don't see any change opening the admin panel ( ).
>> Am I doing something in the wrong way?
>>
>> Thanks for your help.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/d7acce7f-b457-4f6a-99f3-33017d6c9f92%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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%2BWjgXPA4wPZU79UaGGO719-Bfazg%2BgMAMwH9kCnyCV%2BpPh5Kw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAAuoY6NBhK4k9o1hjg5ixofvTEnKHH3BvSS7PQYc9HrjHtJNUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial - Customize the admin look and feel

2014-04-27 Thread Babatunde Akinyanmi
This does not answer the question but you really shouldn't be learning with
the dev version
On 27 Apr 2014 15:38, "rob25"  wrote:

> Hello,
>
> I was following the instructions to create a basic poll application with
> django 1.8 (dev), but now I'm stuck to this 
> paragraph
> .
> My template doesn't override the original.
>
> This is the instruction added at the end of 'settings.py':
> TEMPLATES_DIRS = [os.path.join(BASE_DIR, 'templates')]
>
> This is my directory structure:
> mysite/
> mysite/
> __init__.py
> settings.py
> urls.py
> wsgi.py
> polls/
> templates/
> admin/
> base_site.html
> db.sqlite3
> manage.py
>
> In my 'base_site.html' I replaced '{{ site_header }}' with 'MySite', but
> I don't see any change opening the admin panel ( ).
> Am I doing something in the wrong way?
>
> Thanks for your help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d7acce7f-b457-4f6a-99f3-33017d6c9f92%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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%2BWjgXPA4wPZU79UaGGO719-Bfazg%2BgMAMwH9kCnyCV%2BpPh5Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


problem with BruteBuster

2014-04-27 Thread ogi
Hi

I have a django project with django version 1.5.1 and django-brutebuster 
version 0.1.8.
Although django-brutebuster is properly installed and configured (3 allowed 
attempts), I noticed that the failed attempts are not saved in the database
('BruteBuster_failedattempt' table has no entries)
and under page '/admin/BruteBuster/failedattempt/' it is always shown '0 
failed attempt'.

I have also another older django project with django version 1.2 and by 
testing there is all ok, failed attempts has been saved.

Now I'm testing running django project with django version 1.5.1 on the 
developing server, but it will be shown no error or warning message in the 
terminal, brutebuster is still not working and I realy have no idea how to 
fix this.

Could anybody give me a hint please.
Thanks in advance and greetings.
Ogi

-- 
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/529511ff-4d9a-4131-b6bf-ebeb1fb5cc2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is different of handling character code between pure Python and Django?

2014-04-27 Thread François Schiettecatte
You should check the encoding of stdout when running from django, I suspect 
that it is plain ascii rather than utf-8 which is what you are probably getting 
when running standalone. Check sys.getdefaultencoding().

Note that this has nothing to do with django, just the way stdin/stdout are set 
up depending on how your script is running.

Also see:


http://stackoverflow.com/questions/1473577/writing-unicode-strings-via-sys-stdout-in-python
http://stackoverflow.com/questions/15740236/stdout-encoding-in-python

http://stackoverflow.com/questions/492483/setting-the-correct-encoding-when-piping-stdout-in-python

François

On Apr 27, 2014, at 2:13 AM, Sugita Shinsuke  wrote:

> Hi there
> 
> I’d like to run Java code via Django.
> 
> The Java code, javaprogram use like below.
> 
> —
> java javaprogram [text] [file_name]
> —
> 
> text is parameter. multi-byte character is also okey.
> file_name is generate file name.
> 
> So, I run the stand-alone Python program like below could run fine.
> —
> java_file = ‘javaprogram’
> file_name = ‘filename’
> text = ‘あいうえお’ #Japanese character
> java_file_path = ‘/path/to/‘
> class_path = ‘-cp ' + java_file_path
> 
> cmd = “java {0} {1} {2} {3}".format(class_path, java_file, text, file_name)
> 
> import subprocess
> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
> stderr=subprocess.STDOUT)
> —
> 
> But, I run same program in Django.
> It couldn’t work. However, if text is English, it works fine.
> 
> What is different of handling character code between pure Python and Django?
> And, could you tell me how to resolve it?
> 
> 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/cd081056-2a39-40f5-94c8-7b470bf827ea%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Tutorial - Customize the admin look and feel

2014-04-27 Thread rob25
Hello,

I was following the instructions to create a basic poll application with 
django 1.8 (dev), but now I'm stuck to this 
paragraph
.
My template doesn't override the original.

This is the instruction added at the end of 'settings.py':
TEMPLATES_DIRS = [os.path.join(BASE_DIR, 'templates')]

This is my directory structure:
mysite/
mysite/
__init__.py
settings.py
urls.py
wsgi.py
polls/
templates/
admin/
base_site.html
db.sqlite3
manage.py

In my 'base_site.html' I replaced '{{ site_header }}' with 'MySite', but I 
don't see any change opening the admin panel ( ).
Am I doing something in the wrong way?

Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7acce7f-b457-4f6a-99f3-33017d6c9f92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


change the default value choicefield

2014-04-27 Thread Helton Alves
Hi guys, I'm new here on the list.
I have a question.
yesterday I needed create a form with some fields and one the field was 
using select with choicefield.
I needed edit in label default of select.

was as follows:


I wanted like this:
Your state

I done like this:

get the tuple with all states using the localflavor.br.br_states
I have all states in STATE_CHOICES

add on top of tupla like this:
STATE_CHOICES = ((None, u'Your state'),) + STATE_CHOICES

and then like this:
state = forms.ChoiceField(choices=STATE_CHOICES, required=False)

so I got what I wanted but but I think this resolution was not the best.
could someone show me other resolution more elegant?

-- 
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/e690d4d4-03fb-43e6-b908-886ed52d295e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What is different of handling character code between pure Python and Django?

2014-04-27 Thread Sugita Shinsuke
Hi there

I’d like to run Java code via Django.

The Java code, javaprogram use like below.

—
java javaprogram [text] [file_name]
—

text is parameter. multi-byte character is also okey.
file_name is generate file name.

So, I run the stand-alone Python program like below could run fine.
—
java_file = ‘javaprogram’
file_name = ‘filename’
text = ‘あいうえお’ #Japanese character
java_file_path = ‘/path/to/‘
class_path = ‘-cp ' + java_file_path

cmd = “java {0} {1} {2} {3}".format(class_path, java_file, text, file_name)

import subprocess
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
—

But, I run same program in Django.
It couldn’t work. However, if text is English, it works fine.

What is different of handling character code between pure Python and Django?
And, could you tell me how to resolve it?

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/cd081056-2a39-40f5-94c8-7b470bf827ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and Zinnia + DjangoCMS

2014-04-27 Thread Silvio Siefke
Hello.

On Thu, 24 Apr 2014 09:05:40 -0700 (PDT) Jared Nielsen
 wrote:

> Theming Mezzanine, once you wrap your head around it, is very easy.
> Check out these links to get you started:
> http://theneum.com/blog/styling-twitter-bootstrap-and-mezzanine/
> http://rosslaird.com/blog/customizing-mezzanine/
> http://rodmtech.net/docs/mezzanine/a-mezzanine-tutorial-take-2/

Ok two question i have. 

- Can i not use one template? My html template which i use at moment? 
- I use Nginx for deploying the websites. What is best way with 
Django Mezzanine and Nginx? I think Proxy Pass is to slow, so my
feeling.


Thank you for help & Nice Day
Silvio

Silvio Siefke 

-- 
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/20140427152335.57c705ad5bf4b4f2990fa13b%40gmail.com.
For more options, visit https://groups.google.com/d/optout.