Multi-level list (another ... I think)

2012-09-20 Thread refreegrata
Hello list I have a question. I need to build a multi-level MultipleChoiceField. Something like this: --- Heavy Rain KOF XIII Halo 3 Watchmen Swamp thing Spiderman

check if an user is authenticated from another app

2012-09-14 Thread refreegrata
Hello list. Obviously, I come here with a question. I have a web application developed with Django. It's working Ok. The app is just for internal use and the access to every view is only avaliable for authenticated users with permissions over the section (except for the view log-in) Now

url tag: "'str' object has no attribute 'regex'"

2012-05-17 Thread refreegrata
Hello list I know, this question has been posted and resolved before, but the solutions don't work in my situation. I don't know why. When I try to use the "url" tag in any template an exception is raised: "'str' object has no attribute 'regex'" for example, with this I got the error:

Re: django and unicode

2011-10-12 Thread refreegrata
For example in PostgreSQL, at least from the 8.3 version, you can't have, in the same server, databases with differents encoding. But can be defined a client_encoding for any database. With this you can have a database with encoding='latin1' and client_encoding='utf8'. In postgresql the

Log file with errors

2011-09-23 Thread refreegrata
Hello list. I have a question. To my could be really helpful write a "log file" with the errors, to revise at the next day if something happen. For the moment I have this, a middleware class: -- from

Re: apache+mod_wsgi, redirect to https

2011-05-31 Thread refreegrata
Thanks men, I did this: -- ... ... RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} ... Works ok to me. Now I must to test the "Require Auth". Bye. On 31 mayo, 13:33, Michael

apache+mod_wsgi, redirect to https

2011-05-31 Thread refreegrata
Hello guys and girls. I have a question. In my apache configuration I have this: WSGIScriptAlias /misite "rute_to_file.wsgi" The users can access from: http://mysite/ and https://mysite/ I need to enable the access only from "https://mysite/;. Every access from "http://mysite/; must to be

Re: create a database

2011-05-18 Thread refreegrata
ok, thanks i forget that the settings.py is just a python script. On 18 mayo, 11:02, Shawn Milochik wrote: > Sure, you can do this. > > Just write a Python script that imports settings (it should be on your > PYTHONPATH) and read the database config info, and do your thing.

Re: framework web comparison

2011-04-08 Thread refreegrata
thanks for the answers. On 8 abr, 03:52, Xavier Ordoquy wrote: > > Isn't Ruby a language ? Ok, my mistake, I want to say Ruby on Rails (typing error). Bye. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

framework web comparison

2011-04-07 Thread refreegrata
Hello list. I must to do a document to compare the most populars web frameworks (Django, Ruby, Zend, ...), in terms like performance, utilities, documentation, etc. For this document, the opinions of this list would be helpful. for example, for you, Why I must to choose Django instead of Ruby or

Re: unittest problems

2011-02-24 Thread refreegrata
I add this to my settings: --- TEMPLATE_CONTEXT_PROCESSORS = ( . 'django.contrib.messages.context_processors.messages', <- new line )

Re: unittest problems

2011-02-23 Thread refreegrata
Yeahh , I already try this. The number of errors decreases, but I still have some errors (15) - == ERROR: test_password_change_fails_with_invalid_old_password

Re: unittest problems

2011-02-23 Thread refreegrata
I don't know but maybe the problem is related with this: I use Middleware class provided by Ryan Witt. Whit this class the user must to be authenticated to view any page other than LOGIN_URL Can be this a problem to run the tests? -- You received this message because you are subscribed to the

unittest problems

2011-02-23 Thread refreegrata
Hello list. I have a question. I've never done unit testing with Django before. I still don't write any unittest but when I do this: sudo. / manage.py test Many errors appears. Errors related with the authentication. Errors like:

gantt charts or timeline graphics

2011-02-15 Thread refreegrata
Hello list, I have a question. I need to generate some gantt chart or time line image to represent every step of an element in a process. I already have saved the history, but I need represent this in a graphic. Somebody know some library to do something like this? The idea is build the graphic in

Re: filesizeformat in a view

2011-02-10 Thread refreegrata
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

filesizeformat in a view

2011-02-10 Thread refreegrata
Hello list, I have a question. I want to assign the size of a file to a var in the view, but the value must to be formated in a human- readable file size. This is for a PDF report. In a template I can be used the filter "filesizeformat", but Are some way to use that filter in a view? Thanks for

size of an image

2011-01-24 Thread refreegrata
hello list, I have a question. How can I get the width and the size of an image previously saved?. This is , because I need to generate a report with reportlab, and I must to resize the image, but I need the original size to keep the scale. Thanks and sorry for my bad english -- You received

Re: how can i define a decimal_separator and a thousand_separator

2010-12-29 Thread refreegrata
I still have the doubt.Does anyone know? -- 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

Re: manytomany and form

2010-12-24 Thread refreegrata
finally I do this -- class form(forms.ModelForm): fk_dcto = forms.ModelMultipleChoiceField(queryset= , required=False, widget=forms.CheckboxSelectMultiple) -- with this I can save with checkboxselectmultiple. To define a correctly order to the many to manyfields in

Re: manytomany and form

2010-12-24 Thread refreegrata
to the first question, symmetrical=False, with this generate an inverted information. I want this. id | from_dcto_id | to_dcto_id x |old_dcto 1 | new_dcto x |old_dcto 2 | new_dcto

manytomany and form

2010-12-24 Thread refreegrata
hello list. I have a model like this class Dcto(models.Model): .. fk_dcto = models.ManyToManyField('self', blank=True, null=True) this create a this internal table with

template filter by foreignkey

2010-12-15 Thread refreegrata
Hello list. I have a question. Whit a model like this -- class Ghi(models.model): dat = models.IntegerField(unique =True) class Def(models.Model): ghis = models.ForeignKeyField(Ghi) class Abc(models.Model):

Re: Paginator and foreign key

2010-12-13 Thread refreegrata
thanks for the answer, but the solution don't show anything. I must be doing something wrong. if now I have --- class Myline(models.mode): fk_myDoc = models.ForeignKey(MyDoc, related_name="") --- How Can I use {% for line doc.X_set.all %} in the

Re: Paginator and foreign key

2010-12-13 Thread refreegrata
if I return another list: --- for i in range(len(paginatorDocs.object_list)): resultados = {'myDoc': paginatorDocs.object_list[i], 'myLines': Myline.objects.filter(fk_myDoc=paginatorDocs.object_list[i].id),} --- With this I

Paginator and foreign key

2010-12-13 Thread refreegrata
Hello list, I have a question. Take a look to the next models. class MyDoc(models.Model): code = models.BigIntegerField() class Myline(models.mode): fk_myDoc = models.ForeignKey(MyDoc) --- In my view I do something like

Re: how can I clean a form field before the clean method?

2010-12-04 Thread refreegrata
ok, thanks for the answer. I have a final question. The other way is in the __init__ set initial values in hidden fields, but if the user (malicious) edit the value in some of this fields the form is invalid, and the form comeback, but with the values edited for the user and the error messages.

Re: how can I clean a form field before the clean method?

2010-12-04 Thread refreegrata
Yes, you have reason. I prefer use something like an "exclude" or "fields" tuple in the form meta, and set default values in the model to the fields that I need, but some of the default values are foreign keys. I want to do something like: .default = MyModel.objects.get(field=True) and raise

Re: how can I clean a form field before the clean method?

2010-12-03 Thread refreegrata
Ok, with hidden fields. But if the user manually, with some tool, change the value, thats will be a problem. For my safety I must to use the hidden fields and still keep the clean methods to overwrite any possible editing over the fields value. Originally the idea of this post was search a way to

how can I clean a form field before the clean method?

2010-12-03 Thread refreegrata
Hello list, I want to do something like my_field = 1000(this value can change depending of some situations, but the idea is a value injected with Django, not with some data entered by the user in the HTML form. I already try this: - def clean(self):

how can i define a decimal_separator and a thousand_separator

2010-11-15 Thread refreegrata
Hello list, I have a question. How can i define a custom decimal_separator and a custom thousand_separator independently of the locale?. I don't want redefine this values to every "locale". To my problem, in every the template must to display the same thousand separator and the decimal separator.

Re: clean method in a model

2010-11-09 Thread refreegrata
ode. > > Does that make sense? > > On Nov 9, 2:39 pm, refreegrata <refreegr...@yahoo.com> wrote: > > > ok, thanks for the answer, but I want use the clean method in a model, > > not in a form. For that in the clean method I throw a ValidationError, > > but the e

Re: clean method in a model

2010-11-09 Thread refreegrata
mple shows how to associate a error with a specific field > in a form class. > > On Nov 8, 8:40 pm, refreegrata <refreegr...@yahoo.com> wrote: > > > Hello list. I want to use the clean method in a model. > > -- > > class myMo

clean method in a model

2010-11-08 Thread refreegrata
Hello list. I want to use the clean method in a model. -- class myModel(models.Model): fields def clean(self): raise ValidationError('The Error.') --- Thats works fine. My question

Re: Change the initial data to a modelForm

2010-11-02 Thread refreegrata
This don't work to me. Now I must to use the "." like a thousand separator and the "," like decimal separator (x.xxx,xx) (requirement of the boss). I try to follow the guide to "custom format fields" in the Django documentation, but I can't get formatted numbers. I have this:

Re: Change the initial data to a modelForm

2010-11-02 Thread refreegrata
Thanks, you are the best -- 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

Change the initial data to a modelForm

2010-11-02 Thread refreegrata
Hello list. I have a model "PP" with a "float" field "val" and a modelform for this model For update the data of a existent "PP" I use a form like this Form_for_PP(request,POST, instance=instance) Now my question is, Can I change the initial data for the field "val"? I want to do this: If

Re: change the default widget to a field in a modelform

2010-10-27 Thread refreegrata
If somebody know some way to save a Manytomany field (the departments) manually in the view and not with form.save() would be helpful. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: change the default widget to a field in a modelform

2010-10-27 Thread refreegrata
Yes, I know that, this is strange. My models. -- Table 1: Enterprise Table 2: Department with : fk_enterprise = models.ForeignKey(Enterprise) Table 3: Item with: fk_departament = models.ManyToManyField(Departament)

Re: change the default widget to a field in a modelform

2010-10-26 Thread refreegrata
maybe I not explain correctly. For any modelForm the forms for a field "ManytoMany" are "select multiple". If I want to change this I must to redefine the widget for that field in the declaration of the "modelForm". This works correctly, I can transform the field from "select multiple" to any

Re: nl2br or equivalent to django

2010-10-26 Thread refreegrata
Thanks, is clearly explained in the documentation. I feel embarrassed for do a post for something like this. On 26 oct, 13:25, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Oct 26, 5:02 pm, refreegrata <refreegr...@yahoo.com> wrote: > > > Hello list, I have a newie

nl2br or equivalent to django

2010-10-26 Thread refreegrata
Hello list, I have a newie question, are in django some function like nl2br in the template to print data saved previously from a "textarea"? because in my template all the lines are printed in the same line. P.D.: nl2br is PHP function to do this: "a b c" is tranformed in "abc" Thanks for

change the default widget to a field in a modelform

2010-10-19 Thread refreegrata
Hello list. I have a model with a ManyToMany field. For example: -- class Table(models.Model): myField = models.ManyToManyField(OtherTable) -- The modelForm

Re: MaxValueValidator to validate a model

2010-10-15 Thread refreegrata
Now works. validators=[MaxValueValidator(Decimal('14.5')) But I must to do an explicit declaration Decimal('14.5'). Somebody knows why? On 15 oct, 18:13, refreegrata <refreegr...@yahoo.com> wrote: > Hello list. I want to validate the data in a field of a model. > > with th

MaxValueValidator to validate a model

2010-10-15 Thread refreegrata
Hello list. I want to validate the data in a field of a model. with this validators=[MaxValueValidator(14)] the field is correctly validated but with this validators=[MaxValueValidator(14.5)] always is invalid Somebody know how use the "MaxValueValidator" when the "max_value" is a decimal?

Re: fields in inner join

2010-10-15 Thread refreegrata
y do an unique "join", but the second "join" can do multiple "join"s and I just need the AA fields and the BB fields. Is this idea correct? On 15 oct, 12:27, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Oct 15, 4:19 pm, refreegrata <refreegr...@yahoo.co

fields in inner join

2010-10-15 Thread refreegrata
Hello, how can i get fields from different tables related for a foreign key? When I do a inner join like AA.objects.filter(bb__field = ...) ... I just can access to the AA fields, and not to fields in the other table in a normal query i can do something like "select AA.*, BB.* FROM. AA inner

Re: mtv pattern(diagram)

2010-10-13 Thread refreegrata
Or: request | | V internal controller(urls.py) | | V || | views |<-->model |___|<--->template | | V response is this diagram most specific? have any error?(this post is only because i need put a

Re: mtv pattern(diagram)

2010-10-13 Thread refreegrata
I have some questions. difference between : views in mtv and controllers in mvc, difference between : templates in mtv and views in mvc, I read the documentation for Django, but still not clear to me. -- You received this message because you are subscribed to the Google Groups "Django users"

mtv pattern(diagram)

2010-10-13 Thread refreegrata
Hello i want to do a diagram to explain de mtv pattern. Any idea? for explain the mvc I can do something like: request--->controller->model->view->response | ^ |-| but i

Re: inner join and only method

2010-10-06 Thread refreegrata
starting from Abc works with "select_related" -- 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

Re: inner join and only method

2010-10-06 Thread refreegrata
that don't work. The query can find the "User" fields. On 6 oct, 05:43, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Oct 6, 2:44 am, refreegrata <refreegr...@yahoo.com> wrote: > > > > > Hello list. I'm have a questio. if I have an "inner join&quo

inner join and only method

2010-10-05 Thread refreegrata
Hello list. I'm have a questio. if I have an "inner join" query an use an "only" restriction, how can i put a field of the second table in the "only" tuple? Example: Model - class Abc(models.Model): fk_user = models.ForeignKey(User, related_name='user_pp') fk_ee =

Re: query with "join"

2010-09-08 Thread refreegrata
> EE.filter(dd__ppdd__user=2).distinct() it work. The problem was mine. I must to put in the query the "related_name" not the model name. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: query with "join"

2010-09-08 Thread refreegrata
with something like this: my_query = PPDD.objects.select_related('dd__ee').filter(user=2) can works,but i need do a distinct clause over the rows of "ee" , How can I do that? DD.objects.select_related('dd__ee').filter(user=2).distinct() don't works, because this query pick all the columns,if i

Re: query with "join"

2010-09-08 Thread refreegrata
" = 2) the problem is SELECT U0."id". For my requeriments must to be SELECT U0."departamento_id" And other question. In this query "EE.objects.filter(dd__ppdd__user=2)" how can I put the "related_name" when in a model are more

query with "join"

2010-09-08 Thread refreegrata
Hello list, I have question. With this model: - 1) class EE(Persona): . 2) class DD(models.Model): ee_id = models.ForeignKey(EE) 3) The User table 4) class PPDD(models.Model): user_id = models.ForeignKey(User)

Re: urlencode in Django

2010-09-01 Thread refreegrata
just a few moments ago i saw this in the django documentation. Now works fine. Thanks. On 1 sep, 12:10, Tom Evans <tevans...@googlemail.com> wrote: > On Mon, Aug 30, 2010 at 10:45 PM, refreegrata <refreegr...@yahoo.com> wrote: > > now works for all characters. I don't  know

Re: Django 1.2 modelformset_factory fails with meta: widgets

2010-09-01 Thread refreegrata
rewrite the __init__., redefining the form element in this place. The error must to dissapear. class FormMyForm(ModelForm): def __init__(self, *args, **kwargs): super(FormMyForm, self).__init__(*args, **kwargs) self.fields[''] =

Re: urlencode in Django

2010-08-30 Thread refreegrata
now works for all characters. I don't know why, but now finally works. ñ is converted to "%C3%B1", ó is converted to "%C3%B3", + to "%2B", ... thanks. P.D.: I hate use special characters in an url, generaly is a bad idea, but is necessary in my application. The client want to filter registers

Re: urlencode in Django

2010-08-30 Thread refreegrata
e='the_name'), > > and then in your template use: {% url the_name %} > > If it need a id or similar you can provide it with {% url the_name ID %} > > > > On Mon, Aug 30, 2010 at 23:08, refreegrata <refreegr...@yahoo.com> wrote: > > for the moment i don´t have a problem, the se

Re: urlencode in Django

2010-08-30 Thread refreegrata
that your problem is with codification, and not with urlenconde... > try to search about utf8 and html > > > > On Mon, Aug 30, 2010 at 22:09, refreegrata <refreegr...@yahoo.com> wrote: > > i'm sorry in my last time  accidentally send the post before of > > fin

Re: urlencode in Django

2010-08-30 Thread refreegrata
i'm sorry in my last time accidentally send the post before of finish. I try to do in the template something like {{ my_var|urlencode }} but don't work. Can i do something like an urlencode in the template? P.D.: I'm from Chile. -- You received this message because you are subscribed to the

urlencode in Django

2010-08-30 Thread refreegrata
Hello lista, I'm a newbie in django. In php i have the urlencode function for encoding an url with characters "+","ñ","ó", Has Django an urlencode or similar function? Thanks for read, and sorry my bad english P.D.: django 1,2.1 -- You received this message because you are subscribed to

Re: convert textinput in label or text for a modelform and modelformset_factory

2010-08-16 Thread refreegrata
{{ form.instance.field of the model }} is a way to access. -- 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

Re: convert textinput in label or text for a modelform and modelformset_factory

2010-08-16 Thread refreegrata
somebody have an idea ? -- 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

Re: convert textinput in label or text for a modelform and modelformset_factory

2010-08-13 Thread refreegrata
the idea isn't depend of javascript. -- 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.

Re: convert textinput in label or text for a modelform and modelformset_factory

2010-08-13 Thread refreegrata
{{ fieldcode|id }} or {{ fieldcode.id }} in the template? Best regards On 13 ago, 02:16, Boguslaw Faja <zy...@zymen.net> wrote: > Hi, > > fast question: why fields = ['nombre'] instead of fields = ['name2'] ? > > Best regards > > > > On Wed, Aug 11, 2010 at 3:59 PM, r

overwrite the save method

2010-08-11 Thread refreegrata
Hello list, i have a newbie question My code -- class Format(models.Model): name = models.CharField(max_length=5, unique=True) myBoolean = models.BooleanField(default=False) class FormFormat(forms.ModelForm): boolean1 =

Re: add attributes to a field without widgets

2010-08-11 Thread refreegrata
Opps, I forgot to mention that I work with "Django 1.2.1". Apparently is a Django bug. Other persons has the same question "http://groups.google.com/group/ django-users/browse_thread/thread/c4899b0806e67ee7/d938f33a5f100af8? show_docid=d938f33a5f100af8=1" I will try to implement the solution you

convert textinput in label or text for a modelform and modelformset_factory

2010-08-11 Thread refreegrata
with a model like this: -- class Format(models.Model): name1 = models.CharField(max_length=5) name2 = models.CharField(max_length=5) -- and a modelform like this: -

add attributes to a field without widgets

2010-08-11 Thread refreegrata
Hello list. I'm a newbie in django and now i am working with "modelformset_factory". I have something like this -- class MyForm(forms.ModelForm): myField =

Re: problem with a formset from model

2010-08-11 Thread refreegrata
Nuno > > On Tue, Aug 10, 2010 at 9:21 PM, refreegrata <refreegr...@yahoo.com> wrote: > > Hello list. I have a problem. I'm a newbie in Django using his first > > formset. > > > I have this: > > --

problem with a formset from model

2010-08-10 Thread refreegrata
Hello list. I have a problem. I'm a newbie in Django using his first formset. I have this: class BaseFormFormato_habilitar(BaseModelFormSet): def __init__(self, *args, **kwargs): super(BaseFormFormato_habilitar,

Re: custom form field validation

2010-07-15 Thread refreegrata
in that case(blank) is never be evaluated. On 15 jul, 11:26, Oleg Lomaka <oleg.lom...@gmail.com> wrote: > http://docs.djangoproject.com/en/1.2/ref/forms/fields/#required > > usu = forms.CharField(required=False, ...) > > On Jul 15, 2010, at 5:25 PM, refreegrata wrote: > >

custom form field validation

2010-07-15 Thread refreegrata
Hello list. I'm a newie in django with many questions. I want to do something like this: def (valor): raise ValidationError("A") class

problem with encoding "utf-8", postgresql 8.3

2010-06-09 Thread refreegrata
Hello list. I'm a newbie with django and have a problem with the encoding. I use postgreSQL 8.3 with psycopg2. My database is in latin1 and i can't change this to utf-8(i don't have the permission), however the database have a client-encoding in utf-8. I think this solves the problem. Now my

Re: i can't import newforms(newbie)

2010-06-08 Thread refreegrata
ok, thanks. Now I feel more relaxed. On 8 jun, 15:50, Michael <newmani...@gmail.com> wrote: > On Tue, Jun 8, 2010 at 3:46 PM, refreegrata <refreegr...@yahoo.com> wrote: > > hello list > > i'm a newbie with django trying to learn > > No

i can't import newforms(newbie)

2010-06-08 Thread refreegrata
hello list i'm a newbie with django trying to learn Now i have a question when i do --- from django import newforms as forms django throw an exception : "Error was: cannot import name