[django-users] How to dynamically set crop processor parameters in django-imagekit ?

2013-04-04 Thread Leonardo S
Hi,

I am using django-imagekit to crop images.
I have this model:

*from imagekit.models import ImageSpecField*
*from imagekit.processors import Crop*

*class Image(models.Model):*
*x1 = models.IntegerField(blank=True, default=0)*
*y1 = models.IntegerField(blank=True, default=0)*
*height = models.IntegerField(blank=True, default=0)*
*width = models.IntegerField(blank=True, default=0)*
*image_file = models.ImageField(upload_to='images/')*
*
*
*cropped_image = ImageSpecField(*
*[Crop(width=171, height=82, anchor=None, x=-224, y=-283)],*
*image_field='image_file',*
*format='JPEG', options={'quality': 90})*

How can I use the object's attributes x1, y1, width and height as
parameters to Crop processor ?

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+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.




[django-users] Limit uploaded image properties

2013-03-25 Thread Leonardo S
Hi,

Is there a recommended way to limit an uploaded image, either at resolution
or size in bytes ? And how to do it in Django ?

Regards,
  Leonardo

-- 
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: [django-users] Error when registering a new user - Django 1.5

2013-03-22 Thread Leonardo S
I did it and aparently it worked:

*# forms.py*
*class UserCreateForm(UserCreationForm):*
*
*
*
def clean_username(self):
username = self.cleaned_data["username"]
try:
self._meta.model._default_manager.get(username=username)
except self._meta.model.DoesNotExist:
return username
raise
forms.ValidationError(self.error_messages['duplicate_username'])
*
*
*
*class Meta:*
*model = get_user_model()*
*fields = ('email', 'password1', 'password2', 'first_name',
'last_name', 'bio', 'username')*
*
*
From:
https://groups.google.com/forum/?fromgroups=#!topic/django-users/kOVEy9zYn5c
Should not it be the UserCreationForm standard?


2013/3/23 Leonardo S <leonardo.s.c...@gmail.com>

> Hi,
>
> I am getting an error when registering a new user in a Django 1.5 app.
> It is the postgres' log:
>
> *BRT ERROR:  relation "auth_user" does not exist at character 280*
> *BRT COMMAND:  SELECT "auth_user"."id", "auth_user"."password",
> "auth_user"."last_login", "auth_user"."is_superuser",
> "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name",
> "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active",
> "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."username" =
> E'teste'*
> *
> *
> My code is very simple:
> *
> *
> *# models.py*
> *class User(AbstractUser):*
> *bio = models.CharField(max_length=255, blank=True, null=True)*
> *objects = UserManager()*
>
> *# forms.py*
> *class UserCreateForm(UserCreationForm):*
> *class Meta:*
> *model = get_user_model()*
> *fields = ('email', 'password1', 'password2', 'first_name',
> 'last_name', 'bio', 'username')*
>
> *# views.py*
> *class UserCreateView(CreateView):*
> *form_class = UserCreateForm*
> *model = get_user_model()*
> *
> *
> I think that UserCreationForm yet search for auth_user table.
> A possible solution would be this:
>
> *# models.py*
> *class User(AbstractUser):*
> *bio = models.CharField(max_length=255, blank=True, null=True)*
> *objects = UserManager()*
> *class Meta:*
> * db_table = u'auth_user'*
>
> But i would like to use a correct Django 1.5 approach to register a new
> user.
> Can anyone spot the problem?
>
> Regards,
>   Leonardo
>

-- 
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.




[django-users] Error when registering a new user - Django 1.5

2013-03-22 Thread Leonardo S
Hi,

I am getting an error when registering a new user in a Django 1.5 app.
It is the postgres' log:

*BRT ERROR:  relation "auth_user" does not exist at character 280*
*BRT COMMAND:  SELECT "auth_user"."id", "auth_user"."password",
"auth_user"."last_login", "auth_user"."is_superuser",
"auth_user"."username", "auth_user"."first_name", "auth_user"."last_name",
"auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active",
"auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."username" =
E'teste'*
*
*
My code is very simple:
*
*
*# models.py*
*class User(AbstractUser):*
*bio = models.CharField(max_length=255, blank=True, null=True)*
*objects = UserManager()*

*# forms.py*
*class UserCreateForm(UserCreationForm):*
*class Meta:*
*model = get_user_model()*
*fields = ('email', 'password1', 'password2', 'first_name',
'last_name', 'bio', 'username')*

*# views.py*
*class UserCreateView(CreateView):*
*form_class = UserCreateForm*
*model = get_user_model()*
*
*
I think that UserCreationForm yet search for auth_user table.
A possible solution would be this:

*# models.py*
*class User(AbstractUser):*
*bio = models.CharField(max_length=255, blank=True, null=True)*
*objects = UserManager()*
*class Meta:*
* db_table = u'auth_user'*

But i would like to use a correct Django 1.5 approach to register a new
user.
Can anyone spot the problem?

Regards,
  Leonardo

-- 
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: Django hosting companies

2013-01-29 Thread Leonardo S
heroku, dotCloud, Gondor.io, webfaction ...


2013/1/29 Frankline 

> Have you tried webfaction? Very easy to setup.
>
> On Tue, Jan 29, 2013 at 4:30 PM, Gustavo Andres Angulo 
> wrote:
>
>> There is a similar solution to Heroku, called nuagehq.com
>>
>>
>>
>> regards
>>
>> On Tue, Jan 29, 2013 at 8:17 AM, francislutalo 
>> wrote:
>> > Anyone with an idea of which are the best companies to host my django
>> > applications?
>> >
>> >
>> >
>> > Thank you,
>> > Regards
>> > francislutalo
>> >
>> > --
>> > 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.
>>
>>
>>
>  --
> 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: ImageField upload_to issue

2013-01-25 Thread Leonardo S
There is no t_upload_path


2013/1/25 Sammael 

> Hello, folks!
>
> Here is the relevant part of my model:
>
> def i_upload_to(instance, filename):
> return '/'.join([strftime('i/%y%m/%d'), filename])
>
> def t_upload_to(instance, filename):
> return '/'.join([strftime('t/%y%m/%d'), filename])
>
> class Image(models.Model):
> image = models.ImageField(upload_to=i_upload_to, blank=True)
> thumbnail = models.ImageField(upload_to=t_upload_to, blank=True)
>
>
> It works as expected, but it's really ugly, terrible code. Let's try to make 
> it a little better:
>
> def upload_path(p):
> return lambda instance, filename: '/'.join([p, strftime('%y%m/%d'), 
> filename])
>
>
> class Image(models.Model):
> image = models.ImageField(upload_to=upload_path('i'), blank=True)
> thumbnail = models.ImageField(upload_to=t_upload_path('t'), 
> blank=True)
>
>
> In this case 'image' will be uploaded where expected (e.g. 'i/1301/26'),
> but thumbnail will be uploaded to directory like 't/1301/25/i/1301/26/'
> instead of 't/1301/26'.
>
> Any opinions? Where do I make a mistake?
>
> Thank you in advance for any advice.
>
>  --
> 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.
> 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 post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@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: Which django-cart fork should I use?

2013-01-25 Thread Leonardo S
Hi,

I used this fork once
http://code.google.com/u/101353298620714815735/

But i didn't install. I created my own version based on its code.

Em sexta-feira, 25 de janeiro de 2013, frocco escreveu:
> Hello,
> I installed pip install django-cart, but am having issues when trying to
update a cart with a different qty.
> nothing happens. I see no errors in debug.
> a new product is added ok, but if I try and add the product again, the
qty is not changed.
> if I call the update_cart method, the qty is not changed.
> 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.
> 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 post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@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: define form in yaml file

2013-01-24 Thread Leonardo S
Hi,

I'm new to Django and here.

yaml file is commonly used in Rails framework.
Django uses simple python file (settings.py).

What security risk? Have you got any example ?


2013/1/24 Adrian Andreias 

> Hello,
>
> I need a way to define a django form through a yaml file (or another text
> format).
> Is there some code that already does this?
> I'm trying to not reinvent the wheel.
>
> I can't use simple python classes, since this would user input and would
> be a security risk and I need a simpler and limited format.
>
> Thanks
>
> --
> 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/-/bSxNCc8waMUJ.
> 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.