Adding a CouchDB view

Hello,

I am trying to add a custom CouchDB view in custom.m4change. The path looks
like this: custom/m4change/_design/views/mcct/map.js and the view works
fine in Futon and if I copy it to another module and run syncdb. The
problem I am facing right now is that the view is not added to CouchDB
after running syncdb, even though I have added ‘m4change’ to COUCHDB_APPS
in settings.py. I am not quite sure as to why this isn’t working for me. Am
I missing something?

Thanks
Lech

In order for Django to recognize an app as a couchdb app, the module must
have a models.py file in it where at least one Class subclasses
couchdbkit’s Document class. All over the codebase, there are models.py
files that look like this:
https://github.com/dimagi/commcare-hq/blob/master/custom/trialconnect/models.pyIf
you create a models.py file like that and put it in custom/m4change,
syncdb should now be able to detect custom.m4change and index it’s views.

··· On Wed, Mar 12, 2014 at 6:11 AM, Lech Różański wrote:

Hello,

I am trying to add a custom CouchDB view in custom.m4change. The path
looks like this: custom/m4change/_design/views/mcct/map.js and the view
works fine in Futon and if I copy it to another module and run syncdb. The
problem I am facing right now is that the view is not added to CouchDB
after running syncdb, even though I have added ‘m4change’ to COUCHDB_APPS
in settings.py. I am not quite sure as to why this isn’t working for me. Am
I missing something?

Thanks
Lech


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks, that did the trick. The view is correctly created and indexed now.

Regards
Lech

··· On 03/12/2014 01:49 PM, Yedi Anyansi wrote: > In order for Django to recognize an app as a couchdb app, the module > must have a models.py file in it where at least one Class subclasses > couchdbkit's Document class. All over the codebase, there are > models.py files that look like this: > https://github.com/dimagi/commcare-hq/blob/master/custom/trialconnect/models.py > If you create a models.py file like that and put it in > custom/m4change, syncdb should now be able to detect custom.m4change > and index it's views. > > > > On Wed, Mar 12, 2014 at 6:11 AM, Lech Różański <lrozanski@soldevelo.com > wrote: > > Hello, > > I am trying to add a custom CouchDB view in custom.m4change. The > path looks like this: custom/m4change/_design/views/mcct/map.js > and the view works fine in Futon and if I copy it to another > module and run syncdb. The problem I am facing right now is that > the view is not added to CouchDB after running syncdb, even though > I have added 'm4change' to COUCHDB_APPS in settings.py. I am not > quite sure as to why this isn't working for me. Am I missing > something? > > Thanks > Lech > -- > > --- > You received this message because you are subscribed to the Google > Groups "CommCare Developers" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to commcare-developers+unsubscribe@googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > > > -- > > --- > You received this message because you are subscribed to the Google > Groups "CommCare Developers" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to commcare-developers+unsubscribe@googlegroups.com > . > For more options, visit https://groups.google.com/d/optout.

Just a note that we’re trying hard not to add new views if we don’t have
to, what is the purpose of this view?

··· On 12 March 2014 15:01, Lech Różański wrote:

Thanks, that did the trick. The view is correctly created and indexed now.

Regards
Lech

On 03/12/2014 01:49 PM, Yedi Anyansi wrote:

In order for Django to recognize an app as a couchdb app, the module must
have a models.py file in it where at least one Class subclasses
couchdbkit’s Document class. All over the codebase, there are models.py
files that look like this:
https://github.com/dimagi/commcare-hq/blob/master/custom/trialconnect/models.pyIf you create a models.py file like that and put it in custom/m4change,
syncdb should now be able to detect custom.m4change and index it’s views.

On Wed, Mar 12, 2014 at 6:11 AM, Lech Różański lrozanski@soldevelo.comwrote:

Hello,

I am trying to add a custom CouchDB view in custom.m4change. The path
looks like this: custom/m4change/_design/views/mcct/map.js and the view
works fine in Futon and if I copy it to another module and run syncdb. The
problem I am facing right now is that the view is not added to CouchDB
after running syncdb, even though I have added ‘m4change’ to COUCHDB_APPS
in settings.py. I am not quite sure as to why this isn’t working for me. Am
I missing something?

Thanks
Lech


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Simon Kelly
Senior Engineer | Dimagi South Africa

Hi,

this was for a particularly troublesome report, but I found a better way
around the problem that does not involve creating a new CouchDB view.
That said, it’s good to know what is necessary to make it work in case it
is ever necessary.

Regards
Lech

··· On Wednesday, 12 March 2014 14:25:09 UTC+1, skelly wrote: > > Just a note that we're trying hard not to add new views if we don't have > to, what is the purpose of this view? > > > On 12 March 2014 15:01, Lech Różański <lroz...@soldevelo.com wrote: > >> Thanks, that did the trick. The view is correctly created and indexed >> now. >> >> Regards >> Lech >> >> >> >> On 03/12/2014 01:49 PM, Yedi Anyansi wrote: >> >> In order for Django to recognize an app as a couchdb app, the module must >> have a models.py file in it where at least one Class subclasses >> couchdbkit's Document class. All over the codebase, there are models.py >> files that look like this: >> https://github.com/dimagi/commcare-hq/blob/master/custom/trialconnect/models.pyIf you create a models.py file like that and put it in custom/m4change, >> syncdb should now be able to detect custom.m4change and index it's views. >> >> >> >> On Wed, Mar 12, 2014 at 6:11 AM, Lech Różański <lroz...@soldevelo.com wrote: >> >>> Hello, >>> >>> I am trying to add a custom CouchDB view in custom.m4change. The path >>> looks like this: custom/m4change/_design/views/mcct/map.js and the view >>> works fine in Futon and if I copy it to another module and run syncdb. The >>> problem I am facing right now is that the view is not added to CouchDB >>> after running syncdb, even though I have added 'm4change' to COUCHDB_APPS >>> in settings.py. I am not quite sure as to why this isn't working for me. Am >>> I missing something? >>> >>> Thanks >>> Lech >>> -- >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "CommCare Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to commcare-developers+unsubscribe@googlegroups.com >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CommCare Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to commcare-developers+unsubscribe@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CommCare Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to commcare-developers+unsubscribe@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Simon Kelly > Senior Engineer | Dimagi South Africa >