Re: Model inheritance with constraints

2016-06-01 Thread Arnab Banerji
Nevermind my last comment on this thread, when I refactored my existing 
model into an abstract base class with overrides, and then ran 
"makemigrations", Django said "no changed detected", so it is merely 
treated as a code refactor and not a database related change.

Thanks
AB

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d08ff0d6-63c2-4916-bb0e-6c81dbc7faec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model inheritance with constraints

2016-06-01 Thread Arnab Banerji
Hi Akhil - my issue was how to avoid the new OneToOne relationships, which 
James addressed on this post.

Hi James - thanks a bunch for your help, much appreciated. While I like the 
WYSIWYG nature of this solution, I am not sure if the creation of the 
abstract base class will cause the data already existing in MyFunModel 
table to be modified in any way. 

Cheers
AB

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eaf73ae9-6b9f-4518-b751-e9c2f776caa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Model inheritance with constraints

2016-05-25 Thread Arnab Banerji
Hi all,

I currently have a set of models associated with my Django app, with the 
database already containing data with respect to these tables (models). 

What I have
=

class MyFunModel(models.Model):
my_foo_field = 

What I am attempting to add
=

class MyAnotherFunModel(MyFunModel):
my_another_foo_field = 

Such that the migration gives me *only* _myanotherfunmodel table with 
fields "my_foo_field" and "my_another_foo_field", *without* touching any 
data in the _myfunmodel table. 

None of the options 
in https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance 
seem to address this case, or maybe I am missing something?

Thanks,
AB

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4f897668-3400-4d28-9c67-5d303ddd27e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Concatenate complex views

2016-01-13 Thread Arnab Banerji
Hi - I am trying to concatenate "read-only" form views of all objects 
pertaining to a given model in a single page (I already have a template for 
viewing the form for one object). Given that the forms are reasonably 
complex (in some cases involving formsets), a simple "inclusion tag" 
approach does not work for me (since that requires a simple dictionary). 
Any ideas on what to do here?

Example: a "print all cars" button in a car inventory app, which prints out 
a concatenation of all the car views in the inventory. Eventually, that can 
be exported to a PDF - to be viewed as a comprehensive inventory list.

Thanks!
-AB

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/71d15faf-029f-4412-bfc8-dada465f0727%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Complex form in modelform

2015-10-19 Thread Arnab Banerji
Hi - I am trying to create a form from a model, say M with the following:

(1) a certain field FOO is a text field which would be constructed in 
views.py by concatenating a dynamic set of rows (so I need a jQuery plugin 
for that).

(2) multiple images can be tied to the model M, and I have a ForeignKey in 
the image model that maps to M - I need a jQuery plugin for that too so 
that users can add images dynamically.

(3) If a user gave a name already in use, the form goes into "edit" mode 
for the already existing model (modelchoiceform with validation to the 
rescue?)

Any good examples of the above scenarios? Or a form handling API?

Thanks a ton!
-AB

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1f71bd5-0712-4268-b900-85bcd52a5cd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django w/ XML DOM

2015-09-18 Thread Arnab Banerji
Hi - I am looking for a way to display XML documents in Django and get the 
xml section information from cursor location using XMLCursor like 
capabilities from XMLBeans (or its replacement, jaxb). Is there a supported 
library for that? Unfortunately, JSON would not be a good structure for 
this document, else my life would have been a lot simpler.

Thanks
-AB

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/405884c6-e611-45ad-a8e1-2a081010012f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django split pane with highlighting

2015-09-14 Thread Arnab Banerji
Hi all - here is what I am trying to achieve - I need a split pane view 
with the following contents: 

(1) the right half will contain a bunch of links, 

(2) the left half will be one long static document

Depending on which link is clicked on the right hand side, I want the 
appropriate section of the document on the left hand side highlighted.

What is the best combination of libraries that can help me achieve this?

Thanks a ton,
-AB

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96394e10-a0e1-43f6-8798-d82e252e5953%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django runserver needs restart on psql data changes

2015-04-29 Thread Arnab Banerji
Hi Carl - that was *exactly* what I was doing - thanks a ton for finding 
that issue even without requiring the code. Now that I think about it, 
putting that definition in the global section makes absolutely no sense.

Appreciate your feedback,
-AB

On Wednesday, April 29, 2015 at 5:10:21 PM UTC-5, Carl Meyer wrote:
>
> Hi Arnab, 
>
> On 04/29/2015 03:13 PM, Arnab Banerji wrote: 
> > Hi Javier - thanks for the response. Yes - I am storing the data in a 
> > dictionary - then having django_tables2 API render the dictionary as a 
> > table. How do I force a read of that variable for every browser refresh 
> > on the client side? 
>
> Using a variable is fine; the problem is that (I'm guessing) you are 
> creating that variable at the top level of the module. Such code is only 
> run once, when the module is first imported. 
>
> You need to make sure that all database queries are run only inside view 
> functions (or methods of view classes), never at the top-level of a 
> module. 
>
> carl 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/346855d5-2e89-4ccd-a2e7-0531a9573971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django runserver needs restart on psql data changes

2015-04-29 Thread Arnab Banerji
Hi Javier - thanks for the response. Yes - I am storing the data in a 
dictionary - then having django_tables2 API render the dictionary as a 
table. How do I force a read of that variable for every browser refresh on 
the client side? 

Thanks for your time,
-AB

On Wednesday, April 29, 2015 at 3:09:26 PM UTC-5, Javier Guerra wrote:
>
> On Wed, Apr 29, 2015 at 12:35 PM, Arnab Banerji <arn...@gmail.com 
> > wrote: 
> > The rendering happens perfectly, but the problem is - when the client 
> user 
> > does a browser refresh, the new data does not get reloaded until I 
> restart 
> > the runserver. Is there something I am doing wrong with respect to 
> getting 
> > the data from the database and into my view? 
>
>
> sounds like you're storing that data in a variable.  you should either 
> read it from database on every request, or get some cache invalidation 
> techniques. 
>
> -- 
> Javier 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d2af574-e329-41ca-b2f2-1d1ba03f991e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django runserver needs restart on psql data changes

2015-04-29 Thread Arnab Banerji
Hi all - I am working on a Django app that interacts with a psql database 
via a set of models. 

(1) There is a backend job which keeps updating the database via the same 
models. 

(2) I am creating a table with a view using django_tables2 - and giving it 
a custom dictionary to render using data from the psql database (via my 
Django models). 

(3) I am using 'runserver' fpr testing out my code. 

The rendering happens perfectly, but the problem is - when the client user 
does a browser refresh, the new data does not get reloaded until I restart 
the runserver. Is there something I am doing wrong with respect to getting 
the data from the database and into my view?

Appreciate any help you might give me on this topic,
-AB

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/08207f93-9c4a-4c98-8fca-6499e6735125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.