Re: django.core.email problem
Try look at http://www.packtpub.com/article/friends-via-email-social-web-application-django-1.0 On Wed, Jan 13, 2010 at 8:59 AM, vlkwrote: > I use an smtp server that requires smtplib.SMTP_SSL class to be used > for email sending. The usual EMAIL_USE_TSL=True setting doesn`t work. > > Changing following lines in the django.core.mail module from > >self.connection = smtplib.SMTP(self.host, self.port, > > local_hostname=DNS_NAME.get_fqdn()) > to > >self.connection = smtplib.SMTP(self.host, self.port, # > port here set to 487 in the settings.py module > > local_hostname=DNS_NAME.get_fqdn()) > > seems to fix the problem. > > I wonder if there is a reasonable way to fix the issue without > touching core django code? > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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-us...@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: How to define new permission
Ban co the lam dieu do mot cach de dang .Django da co phan Admin de ban quan li dieu do. theo cau hoi cua ban.la ban da dung admin cua django.ban chi can vao phan quan li user roi ban tao theo user .va danh phan permission cho tung user ma ban vua tao. chuc ban thanh cong. On Fri, Aug 7, 2009 at 3:15 PM, Toan Vuwrote: > > Dear all, > > I've created a new application which used the default admin site of > Django framework. I have a model which have these line of code: > Class Meta: > permissions = (('permission_name':'Readable human name'),) > > This line of code created a new permission in > 'auth_user_user_permissions' table and I can set this new permission > to a specified user. The problem is after I only set this permission > to the user and I logged in by this username and the admin's home page > shown 'You don't have permission to edit anything.'. When I set a add, > change,. permission to this model and then It shown the app list. > > Could you mind show me how to add new permission like the defaul > permission of the admin site like add, delete, change ? > > Cheers. > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Os.path in window and linux help?
My structure project -- myprjetct -myapp -site_media -images -template -report -employee_report_pdf.html this is the def in my view.py # return ouputting_pdf('reports/employee_report_pdf.html',{ 'pagesize':'A4', 'curr_employee':get_employee, 'status':status, 'url':'../'+settings.MEDIA_ROOT, #'url':os.path.join('..',settings.MEDIA_ROOT), # 'url':os.path.join(os.path.dirname(__file__),'site_media'), 'age':employee_age() }) -- and this is mytemplate --- - this application is to make a report(reportlab,xhtml2pdf,pisa ) .it works fine on my OS( Ubuntu ) But the images could not display on other OS(Windows) look at my templates source code i try to works on cross platforms such as linux ,windows. Anyone have an experience with os.path to work cross platforms Please help me to resolve this problem. thanks. --~--~-~--~~~---~--~~ 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: Problem with uploading a ImageField through ModelForm
please make sure you have corrected like this *setting.py* MEDIA_ROOT = '*site_media*' #make sure your have it already!! and it's your problems also TEMPLATE_DIRS = ( 'templates', ) *models.py* = from django.db import models class photos(models.Model): caption = models.CharField(max_length=10) photo = models.ImageField(upload_to= 'images/photo') == *views.py* == from django.forms import ModelForm from django import forms from django.shortcuts import render_to_response from django.http import HttpResponse, HttpResponseRedirect from djangotest.upload.models import photos from django.core.urlresolvers import reverse class MyForm(ModelForm): class Meta: model = photos def upload(request): if request.method == "POST": form = MyForm(request.POST, request.FILES) #make sure this line if form.is_valid(): sheet = form.save() return HttpResponseRedirect(reverse('upload_thanks')) return render_to_response( "upload.html", { "form" : MyForm(), } ) === *urls.py* from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # ... url( r'^upload/$', 'upload.views.upload', name="upload" ), url( r'^upload/thanks/$', 'django.views.generic.simple.direct_to_template', { 'template' : 'upload_thanks.html' }, name="upload_thanks" ), ) == create in templates folder (template folder the same directory the applications not project in sample code) == {% for field in form %} {{ field.errors }} {{ field.label_tag }}: {{ field }} {% endfor %} == ! you see in the template form the *action *='.' it will store the photo in * site_media/image/photo/* my folder structure : uploadtest-->myproject -upload -->my application -template -->my template folder -site_media -->my site media to store the files such as photos. Hope it can help you. from* KSO.* On Wed, Apr 29, 2009 at 3:26 AM, Aaron < substantialnoninfringingu...@gmail.com> wrote: > > Hey, this looks like the same problem I had earlier. The gotcha was > that I needed enctype="multipart/form-data" in my form tag, like enctype="multipart/form-data" action="" method="post"> > > Hope this isn't too late! > > Aaron > > On Mar 9, 5:34 am, Marek Wawrzyczekwrote: > > Hi, > > > > I've got the code like this: > > > > class Photo(models.Model): > > image = models.ImageField(upload_to='photos') > > > > class PhotoForm(ModelForm): > > class Meta: > > model = Photo > > > > View function fragment: > > > > if request.method == 'POST': > > post = request.POST.copy() > > print 'post: %s' % post > > photoForm = PhotoForm(post) > > if photoForm.is_valid(): > > print 'photoForm valid' > > photoForm.save() > > else: > > print 'photo form is invalid' > > return render_to_response(template_name, {'photoForm' : > photoForm}) > > else: > > photoForm = PhotoForm() > > return render_to_response(template_name, { 'photoForm' : > photoForm}) > > > > Template fragment: > > > > > > > > > > {{photoForm.non_field_errors}} > > {{ photoForm.as_p }} > > > > > > > > Through the admin interface, I can add new photos, but when I try to add > > it through the page, then the > > "This field is required." message is posted, and the output on the > > console is: > > > > post: > > photo form is invalid > > > > When I try to use FileField it works the same. How can I slove this > > problem ? > > > > Regards, > > Marek > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---