Re: Share models between django apps

2012-08-06 Thread Rajeesh Nair
Checked for any circular import between these apps also? I guess you already know such possibilities. Just asking to make sure. Rajeesh. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web vi

Re: Share models between django apps

2012-08-06 Thread Rajeesh Nair
Hi, Please clarify what exactly is the failure. Is it raising ImportError? Then, Try "import from project.common.models" instead of "common.models". Rajeesh. -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Custom field names in ModelForm

2012-05-10 Thread Rajeesh Nair
> Is there a way to customize the field name (not just label) while creating > a ModelForm? > > Override the change_form template for the concerned model and put the label for the field in whatever way you like. Check out the django-templates documentation to know how to do this. -- You re

Re: filtered admin change-list

2012-03-19 Thread Rajeesh Nair
Add a field on your model to identify the user who created each instance & then extend your model_admin's queryset method to filter queryset by the user. On Sunday, March 18, 2012 4:37:43 AM UTC+5:30, omerd wrote: > > every user will see only the instances that he'd created. Of > course, this

Re: calculated form field

2012-03-19 Thread Rajeesh Nair
Your FormClass expects all 3 fields to be optional (*required=False*). But your code in view always expects them to have integer values. And you end up multiplying values from two blank fields! Either you provide some default value to the fields or rewrite view to use *form.cleaned_data.get*wit

Re: hiding the delete button

2009-09-30 Thread rajeesh
ete'. Change the above line to .. 'has_delete_permission': context.get('show_delete',True) and self.has_delete_permission(request, obj). I hope this should solve the problem. I'd opened a ticket requesting this change. But it was marked as 'wontfix' f

Re: ANN: Django 1.1 released!

2009-07-29 Thread rajeesh
Applause! --- Rajeesh --~--~-~--~~~---~--~~ 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,

Re: colMS and how to put stuff in sidebar??

2009-07-20 Thread rajeesh
On Jul 20, 4:06 am, sico wrote: > Hi, > > Using django 1.0.2 and I'd like to put some extra read-only info in a > sidebar on the editing forms for specific models. > > coltype= colMS looks perfect for this, but how/where do I tell django > what I want to put in the sidebar?? > > thanks, > Simon

Re: customizing admin template - how to refer to specific field

2009-07-20 Thread rajeesh
On Jul 20, 9:38 am, sico wrote: > Its quite simple to customize the admin template for a specific model > by creating a change_form.html in the templates/admin// > / directory. > > But, is it possible to refer to particular fields in the model/form > directly? > > Instead of using the loops: >

Re: Where to put jquery/dojo js files

2009-03-09 Thread rajeesh
For the time being, I'm using the previous suggestion. I've just heard about dojango earlier and I hope I can try it later. Thanks. On Mar 9, 2:43 pm, Wolfram Kriesing wrote: > Did you try dojango?http://code.google.com/p/dojango/ > Dojango is a reusable django application that helps you to use

Re: Where to put jquery/dojo js files

2009-03-08 Thread rajeesh
Yes, It worked. A l'll worried over their caution not to use it in production. Never mind if we use Apache or something else. Thanks Carlos. > Have you looked > athttp://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs? > Maybe it helps... > > Regards, > Carlos. --~--~---

Re: Inserting Into Cleaned_Data Inside a ModelForm

2009-03-06 Thread rajeesh
You may change the save_model() method of corresponding AdminClass for that: e.g, to set the attribute 'a' of model 'Book' , write inside BookAdmin.save_model() something like this: obj.a = form.cleaned_data['another_key'] * 2 obj.save() On Mar 6, 8:43 pm, Waldemar Kornewald wrote: > On 6 Mrz.,

Re: Populating foreign key fields when displaying forms that extend ModelForm

2009-03-01 Thread rajeesh
> On Sun, 2009-03-01 at 06:36 +0200, Ionut Gabriel Stan wrote: > > When rendered, the > > form includes a SELECT widget for selecting the blog post to which the > > comment > > belongs, but the post is already known. So how do I specify the post > > id so that > > the form renders a hidden field w

Re: How to populate a custom ModelForm?

2009-02-26 Thread rajeesh
Ok, thanks for your time. --~--~-~--~~~---~--~~ 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-

Re: How to populate a custom ModelForm?

2009-02-26 Thread rajeesh
Sorry for repeating this, but I'm still clue-less on it and the deadline approaches fast: The current work_around(http://dpaste.com/ hold/427) seems too ugly. But that's not why I'm back. I've stumbled upon one more similar problem. Both can be grouped together into this statement: What's the righ

Re: Admin/Application Integration and Automatic Actions

2009-02-25 Thread rajeesh
> > > * Is there a standard model for running automated tasks?  I was thinking > > about a cron task that uses lynx or curl to call a URL that performs the > > task, but that gets kind of ugly.  Is there a better way to do this? > What about the django-cron? Just check it out here: http://code.go

Re: How to populate a custom ModelForm?

2009-02-23 Thread rajeesh
Pasting the code here to check any further problem ;) ## I've a model like this: class Receipt(models.Model): r_number= models.IntegerField() transaction = models.OneToOneField(Transaction,editable=False) ## Transaction is from another app and there it is used as usua

Re: How to populate a custom ModelForm?

2009-02-23 Thread rajeesh
> I get "Item not found" when I go to that entry. > I don't know what happened. I'd checked the link many times yesterday. But 'not found' by today! Anyway, pasted once more to http://dpaste.com/hold/427/ . > That sounds like the normal use-case for Meta.exclude in the ModelForm. > Can you just

Re: increase integer

2009-02-22 Thread rajeesh
If what you mean is just to hide it from the user, try adding a hidden input to the form and set its value as number. Now there is no need of that number argument in the count's signature. Instead get number as number = request.POST['number']. --~--~-~--~~~---~--~~

Re: How to populate a custom ModelForm?

2009-02-22 Thread rajeesh
Sorry for not including the code before. I've dpasted it now: http://dpaste.com/123850/ . Problem can be summarized as this: I've a model M with certain fields and some foreign keys. I don't want the user to add/edit the FK directly from M's ModelForm. Instead we'll do that in code from certain

Re: increase integer

2009-02-21 Thread rajeesh
Try to modify your form_action to "/mysite/count/{{ number }}" and edit urls.py to change corresponding rule as something like r'/mysite/ count/(?P\d*)'. Doesn't that render_to_response line contains a typo? It must be {'number':new_number}. --~--~-~--~~~---~--~~ Yo

Re: How to populate a custom ModelForm?

2009-02-21 Thread rajeesh
Well, Let me re-phrase that question: I'm currently using the following line of code to populate text_input fields in the custom form: form.base_fields['r_date'].widget.attrs['value'] = obj.transaction.trans_date But is this acceptable way of coding? If yes, how can I populate ChoiceFields? --~--