Custom Login Url Django Admin Site

2010-03-12 Thread d3f3nd3r
Hi,

is there a nice way to redirect the user to a custom login page when
accessing a django admin site?

I'm thinking about something like LOGIN_URL in settings.py.

regards

-- 
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: ImageFiled Uploads

2008-07-16 Thread d3f3nd3r

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Molly wrote:
> Also, make sure you import ImageField at the top:
> 
> from django.db.models import ImageField
> 
> And, do you have the PIL downloaded??
> Did you import Image?
> 

hello,
I have another problem with file upload.
request.FILES['file'] represents a dictionary in my view, not an object.

Here is my code :
class UserPicForm(forms.Form):
userpic  = forms.FileField()

form = UserPicForm(request.POST,request.FILES)
if form.is_valid() :
handle_userpic(request.FILES['userpic'])

def handle_userpic(f):
    destination = open('/home/d3f3nd3r/hackerspace-os/mos/media/tmp', 'wb+')
for chunk in f.chunks() : -> ERROR : 'FileDict' object has no attribute 
'chunks'
destination.write(chunk)

I think I followed the docs at
http://www.djangoproject.com/documentation/upload_handling/ but it didnt work.
Any ideas ?

regards

> > 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIfkLzM/NgBE4GzRgRAiTKAJ9ldZrJEpnkp2YhmSTCcGGv9BVg5QCgjVfr
coc147x11eZsy9CJpsjw+rY=
=yO8y
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ImageFiled Uploads

2008-07-17 Thread d3f3nd3r

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



Yeah thank you, had an outdated django version.

but I have another fundamental question about ImageField.
If I use ImageFields in a Form, does to form handle the storage for me or have I
to save the image specially?
Because I cant figure out how ImageField works.

here is my code

model :
class ContactInfo(models.Model):
wiki_name = models.CharField(max_length=50, blank=True, null=True)
image = models.ImageField(upload_to='/site_media/userpics/', blank=True)
user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED,
num_in_admin=1, max_num_in_admin=1)

form :
class UserPicForm(ModelForm):
class meta:
model = ContactInfo
include = ('image')

view :
ci = ContactInfo.objects.get(user=current_user)
form = UserPicForm(request.POST,request.FILES, instance=ci)

if form.is_valid() :
form_data = form.save()
print form_data.image # prints an empty string and I dont know why

form :
 
 Image
   

regards
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIf4OzM/NgBE4GzRgRAlVVAKCL9fye86FITb+8fiheBK7hk20B0wCffZdK
Nf6tR66EfrBEzY7waig/pXE=
=6T7t
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---