Re: Suggestions for Paginating a Growing Django Queryset

2014-05-30 Thread Babatunde Akinyanmi
Like someone said, you can consider caching the entire queryset. That will definitely impact memory. Another idea is to play with timestamps in your query since you don't care if the results are not accurate. Maybe you shouldn't paginate then you can draw out the whole queryset, render them on the

saving backbonejs model with django backend

2014-05-30 Thread Eddilbert Macharia
Hi Guys, how do i save a backbone model in the database ?? here is how i have tried it and the errors i am getting, please assist , /* * * * the field model * * */ var fieldModel=Backbone.Model.extend({ defaults:{ name:'', type:'', placeholder:'',

Re: Enumerating objects in foreign key in the admin

2014-05-30 Thread Russell Keith-Magee
Hi Christophe, The built-in way to handle this is to add a `raw_id_fields` declaration to your ModelAdmin or Inline definition. This will replace the pulldown select widget (populated with every possible value) with a single text input that stores the primary key of the related object, plus a popu

Enumerating objects in foreign key in the admin

2014-05-30 Thread Christophe Pettus
Right now, when one has a foreign key field in a detail page in the admin, it appears to enumerate the objects (one at a time) in order to build the pop-up. Obviously, if the other side of the foreign key relationship has a lot of entries, this can be a problem. Short of doing a different, cus

Re: Django Template - problema

2014-05-30 Thread Erick Brockes
Problem solved by replacing on models.py: TIPO_CONJUGE = ( ('CA', _('Casados')), ('UE', _('União estável')), ('OU', _('Outros')), ) by TIPO_CONJUGE = ( ('CA', _('Casados')), ('UE', _('Uniao estavel')), ('OU', _('Outros')), ) I'll see how t

Re: django ugettext translation glitch or as designed?

2014-05-30 Thread visionary800
Thank you Ramiro! That was it - I changed to ugettext_lazy() and it worked! I want to separate the text from the templates - this is why I want to place the text in a separate file. Placing the text within the template is a d What approach should I take to just separate the text from from the

Re: Django Template - problema

2014-05-30 Thread Erick Brockes
Kevin, Thank you. If you don't mind, I'm kind of new in django. I've got the following response in the browser: {'tipo_conjuge': } Could you help me out on how to proceed? 2014-05-30 18:45 GMT-03:00 Kelvin Wong : > In relacaoconjugetipouniao_form.html > > Add this tag...then refresh... > > {

Re: django ugettext translation glitch or as designed?

2014-05-30 Thread Ramiro Morales
On Fri, May 30, 2014 at 10:51 PM, visionary800 wrote: > Bad: 2 - This Fails: when ugettext is in another file > file : /project/app/views.py > > ...other imports > from .mytext import FROM_ANOTHER_FILE > > class BaseView(ContextMixin, View): > template = 'base.html' > > def get(self, reque

Re: Seems to be a bug in makemessages management command

2014-05-30 Thread Russell Keith-Magee
Hi Андрей, On Fri, May 30, 2014 at 9:50 PM, Андрей Меньков < nothingelsematte...@gmail.com> wrote: > May be it would better to post this to "Django developers" mailing list? > Possibly - if you think you've found a bug, django-developers is a better audience for that. django-users is a better au

Re: django ugettext translation glitch or as designed?

2014-05-30 Thread visionary800
Sorry for the large text... I forget to change it - I guess I am going blind :-) On Friday, May 30, 2014 6:51:35 PM UTC-7, visionary800 wrote: > > I am running into a challenge. For both examples below everything is good > except when I move the ugettext() to a separate file. > Good: After runn

django ugettext translation glitch or as designed?

2014-05-30 Thread visionary800
I am running into a challenge. For both examples below everything is good except when I move the ugettext() to a separate file. Good: After running the django-admin.py makemessages -l es, both examples produce the appropriate .po file. Good: I change ../locale/es/LC_MESSAGES/django.po

Re: makemessages doesn't understand I'm reusing Django existing translation messages

2014-05-30 Thread visionary800
My recent experience with using django-admin.py makemessages is that this command only works when there is a subdirectory present named 'locale' that sits just below where you are executing this command. Without a 'locale' subdirectory present, the command will raise an error. I think by desig

Re: Registration extend nightmare

2014-05-30 Thread Kelvin Wong
This is not an answer to your question, but I have used Django-registration before and ran into its limitations. Consider all the time you spent trying to debug this then consider that you'd probably already be done if you had just wrote a custom user and maybe salvaged some of the nicer code f

Suggestions for Paginating a Growing Django Queryset

2014-05-30 Thread Riegie Godwin
Hello everyone! I've been stuck for about a week trying to figure this out. Been on all sorts of blogs and asked questions on stackoverflow in hopes that it would lead in the right direction. I would like to know what you think I could do. Let's say I have 4 models, a User model, Blog

Re: Django Template - problema

2014-05-30 Thread Kelvin Wong
In relacaoconjugetipouniao_form.html Add this tag...then refresh... {{ form.fields }} Should give you more info about what fields are in the form and what widget they are using. ie. 'tipo_conjuge': django.forms.fields.TypedChoiceField object Also check your html source in a browser. Sometimes

makemessages doesn't understand I'm reusing Django existing translation messages

2014-05-30 Thread Selenite Vingt-Neuf
Hi, I'm writing authentication templates using authentication views provided by Django, and for that purpose I am reusing translation messages present in django.contrib.admin. That works very well at the execution time, Django understands that translation messages already exist in django.contr

Fwd: Django Template - problema

2014-05-30 Thread Erick Brockes
I have the following problem. The field "tipo_conjuge" is not showing as I wanted. Could somebody tell me what is the problem? Best regards, Erick url. py ... url(r'relacao/(?P\d+)/$', login_required(CreateTipoRelacaoView.as_view()), name='cadastrarRelacaoTipo'), ... views.py ... class Creat

Registration extend nightmare

2014-05-30 Thread Matt Guy
I am trying to add an extra user profile registration field using registration. Should be so simple but this is bringing me to the edge. Here's my stackoverflow question with bounty: https://stackoverflow.com/questions/23695713/django-reg-extend-current-transaction-is-aborted-commands-ignored-u

check_password in contrib auth tries to update the database

2014-05-30 Thread suhridsatyal
Hi, I am getting this error > cannot execute UPDATE in a read-only transaction from a method in auth module that supposedly checks for password. check_password method of AbstractBaseUser in django.contrib.auth.models tries to update the database. This causes problems when this code executes

Re: Seems to be a bug in makemessages management command

2014-05-30 Thread Андрей Меньков
May be it would better to post this to "Django developers" mailing list? пятница, 30 мая 2014 г., 15:53:56 UTC+3 пользователь Андрей Меньков написал: > > Django management command doesn't recognize multiline strings as strings > to localize. So such strings don't appear in resulting django.po fil

Re: backbonejs and django

2014-05-30 Thread Eddilbert Macharia
Hi sanjay, Thanks for your reply,here is how I did it this way $(function(){ // event object var vent=_.extend({},Backbone.Events) // the model var myModel=Backbone.Model.extend(); // the model collection var myModelCollection=Backbone.Collection.

Seems to be a bug in makemessages management command

2014-05-30 Thread Андрей Меньков
Django management command doesn't recognize multiline strings as strings to localize. So such strings don't appear in resulting django.po files after running command For example for such a string {code} {{ _(''' fhsdafjkshdfjkasdhfksj ytyerwtuiwyertuiywert''') }} {code} I might be the b

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
I get same error as before; 'NoneType' object has no attribute 'readiness' when I changed to your excample. I don't understand why this is not working for me, but for everyone else Is it something I have forgot to import? I hope you can take a quick look at my uploaded files. Is it ok to ju

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
try this get_form: def get_form(self, request, obj=None, **kwargs): if obj.readiness: self.exclude = ("readinessDescription", ) return super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs) I have never used 'exclude' but it looks like yours should work. On Fri, May 30, 2014 at 9:

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
I have uploaded my model and admin file and hope someone can tell me why I can't get my get_form method to work :) Regards, Hilde > >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
Thanx, I now changed my if test to just if obj.readines but then I get the error message 'NoneType' object has no attribute 'readiness' I have tried with several fields from my model, but I always get this error. I guess it must be something essential I am doing wrong here, since my obj seems

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
Maybe it is not possibly to get a fields attribute value from admin before the admin form is posted or stored in database? Do you know? Yes, it is possible. I use this to set which fields are readonly before defining the fieldsets. It works great. def get_form(self, request, obj=None, **kwargs

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
What do you mean by tri-state? You are using a field that allows three states: TRUE, FALSE and NULL. If I understand the model, readiness would either be TRUE or FALSE. But if you do not want to change your field type to: readiness = models.BooleanField("Readiness", blank=True) then try changin

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
and one more thing. My obj is always none (empty), why is that? On Friday, May 30, 2014 1:49:12 PM UTC+2, Hilde Rafaelsen wrote: > > Hi, > > > > Thanks for the response. > > > > What do you mean by tri-state? > > > > I changed my get_form to this: > > def get_form(self, request, obj=None,

Re: OneToOne? Inheritance? Another solution for nested model relationships?

2014-05-30 Thread Rafael E. Ferrero
2014-05-26 18:33 GMT-03:00 Daniele Procida : > I've an application that's been happily running for a few years, that does > this: > > class Person(Model): ># everyone's a Person > > class Researcher(Model): > # a Researcher is Person who publishes research > person = models.OneToOneFie

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
Hi, Thanks for the response. What do you mean by tri-state? I changed my get_form to this: def get_form(self, request, obj=None, **kwargs): form = super(RequestForChangeAdmin, self).get_form(request, obj, **kwargs) if o

Re: Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Timothy W. Cook
Is 'readiness' really a tri-state flag? Anyway you may want to test if obj.readiness exists, and is TRUE. if obj.readiness and obj.readiness == TRUE: HTH, Tim On Fri, May 30, 2014 at 7:57 AM, Hilde Rafaelsen wrote: > Hello, > > In my django admin page I want to hide some filelds from users

Problem hiding fields from admin page based on another fields value

2014-05-30 Thread Hilde Rafaelsen
Hello, In my django admin page I want to hide some filelds from users if a special field value is set. I have tried different solutions to solve my problem but is stucked and hope someone can help me, If you look at my model I want to hide the field readinessDescription if readiness value is F

Re: Django and Rails

2014-05-30 Thread Derek
Hi Enrique Apart from the mailing list, a good place to keep up with Python and Django in general is the http://www.pythonweekly.com/ newsletter. Its not long, is well-structured and will help give some idea of the current "buzz" ... (PS Not everyone is convinced that Rails is "faster" - ht

Re: OneToOne? Inheritance? Another solution for nested model relationships?

2014-05-30 Thread Leonardo Giordani
I see your point. In this case I'd recommend giving Researcher two foreign keys, one towards a Student model and one towards a Staff one, then add some logic to the model to easily check the actual specialization or to convert it among them. Basically you get a Researcher that "owns" a Student or a