Got the point. Still, I am encountering the following 2 issues-- 1] ===================== With "colors" --- The add & edit links do not work. After clicking add or edit, 'default' page is displayed. ===================== With "color" --- The add & edit links work, but the add-form is throwing traceback (after clicking submit button)--- AttributeError: 'ColorController' object has no attribute 'replace'). =====================
2] In "class ColorEditForm(EditableForm)", I have specified "SingleSelectField(options=act)" for a field "active". It displays a "TextField" control. It works fine in "class ColorForm(TableForm):" and how do I avoid pagination, but instead get an infinitely scrolling table. Regards, Vineet. =========================================== On Feb 28, 7:37 pm, Michael Pedersen <[email protected]> wrote: > I apologize. I was looking to get into some other issues last night, and > didn't provide enough of an explanation. > > The reason it works with "colors" and not "color" is because of the way that > tgext.crud works. > > tgext.crud needs to provide links for people to follow/use. These links have > to be able to go up a level, and refer back down into the same tree. So, for > instance, the following links need to all work: > > http://example.com/colors/1/edithttp://example.com/colors/get_allhttp://example.com/colors/2/delete > > And all of them have to point to the same controller. As a result, you can't > use the "./" trick (where URLs point to ./get_all for example). Otherwise, > you'll get infinite depth over time, with URLs that look like this: > > http://example.com/colors/1/get_all/2/delete/5/edit > > The links have to point to the mounted location of the controller. The only > way to do that that could be found was to define what the controller name > had to be. It made sense to use a plural version of the model name. In your > case, "colors" instead of "color". > > Better options will be gladly accepted :) > > On Mon, Feb 28, 2011 at 4:07 AM, Vineet <[email protected]> wrote: > > That's great. It worked. > > But I am really Crazy why it works with 'colors', but not with 'color' > > (since it is just the name of the class-instance, any name should > > work). > > (I am getting page numbers, not next & prev links). > > I have additionally installed tw.dojo library. > > > 1] > > ===================== > > With "colors" --- > > The add & edit links do not work. > > After clicking add or edit, 'default' page is displayed. > > ===================== > > With "color" --- > > The add & edit links work, although the add-form is throwing traceback > > (after clicking submit button)--- > > AttributeError: 'ColorController' object has no attribute 'replace'). > > ===================== > > Actually I do not want pagination, but infinitely scrolling table. > > > 2] In "class ColorEditForm(EditableForm)", I have specified > > "SingleSelectField(options=act)" for a field "active". > > It displays a "TextField" control. > > It works fine in "class ColorForm(TableForm):" > > > Regards, > > > Vineet. > > =========================================== > > > On Feb 28, 7:46 am, Michael Pedersen <[email protected]> wrote: > > > Well, I've figured it out, and you're going to go crazy when I tell you. > > > > In your mwhl/controllers/root.py, you have this line: > > > > color = ColorController(DBSession) > > > > Change it to this line: > > > > colors = ColorController(DBSession) > > > > That fixes the next/prev links. Well, as far as I can tell. I know you've > > > got something different (i.e.: not listed in your setup.py), since I get > > > page numbers, instead of next/prev. What extra widget libraries do you > > have > > > installed, so I can get closer to your environment? > > > > On Sun, Feb 27, 2011 at 12:53 PM, Vineet <[email protected]> > > wrote: > > > > Michael, > > > > Thanks for sparing your time on this. > > > > I have created hg repository for my code:- > > > > > "https://bitbucket.org/d_vineet/mywheels" > > > > > I have more that 70 records filled in "clr" table (in MySQL). > > > > When the table "color" is rendered (http://localhost:8080/color), it > > > > displays a handful of records, and links to the next pages. > > > > (These links are not working. After clicking them, the "default" page > > > > is rendered). > > > > > Then, in "class ColorEditForm(EditableForm)", I have specified > > > > "SingleSelectField(options=act)" for a field "active". > > > > It displays a "TextField" control. > > > > It works fine in "class ColorForm(TableForm):" > > > > > Regards, > > > > > Vineet. > > > > =========================================== > > > > > On Feb 26, 10:14 pm, Michael Pedersen <[email protected]> wrote: > > > > > I've finally gotten the chance to really look at this, and simply > > can't > > > > > reproduce your issue. I strongly suspect it's because I've got > > something > > > > > different about the code setup I've created versus what you have. > > > > > > Is there any way you can provide a source tree that I can use to > > > > reproduce > > > > > the problem? I don't really care *what* version control you're using: > > > > Git, > > > > > SVN, Hg, even CVS, I just need *something* I can use to clone your > > > > > environment. Once I can do that, reproducing the problem should > > become > > > > > extremely easy, and then we can work on fixing it. > > > > > > On Sat, Feb 26, 2011 at 9:21 AM, Vineet <[email protected]> > > > > wrote: > > > > > > Hi ! > > > > > > Any light on the issue? > > > > > > > Regards, > > > > > > Vineet. > > > > > > ==================== > > > > > > > On Feb 24, 8:31 pm, Michael Pedersen <[email protected]> > > wrote: > > > > > > > I apologize, but I was not able to get to it last night. Been > > working > > > > > > > through the GSoC application. It's more detailed than I thought > > it > > > > would > > > > > > be. > > > > > > > > On Thu, Feb 24, 2011 at 12:58 AM, Vineet < > > [email protected]> > > > > > > wrote: > > > > > > > > Thanks Michael for your response. > > > > > > > > I encountered some errors with GIT. > > > > > > > > So instead of shedding too much of time on that, I have emailed > > a > > > > zip > > > > > > > > of my project dir on your email ID. > > > > > > > > (Since GoogleGroups has deactivated the feature of posting > > files, I > > > > > > > > had to email it to you). > > > > > > > > > Pl. see if you can help me. > > > > > > > > > Thanks, > > > > > > > > > Vineet. > > > > > > > > ==================================================== > > > > > > > > > On Feb 23, 11:18 pm, Michael Pedersen <[email protected]> > > > > wrote: > > > > > > > > > I'll try with this tonight, and hope I can get it to work to > > at > > > > least > > > > > > > > > reproduce the problem. The reason I asked for git/hg is so > > that I > > > > can > > > > > > > > > definitively reproduce the problem using the same code in the > > > > same > > > > > > layout > > > > > > > > > you're using, and I'm not guessing. > > > > > > > > > > I'll still try, but would very much appreciate it if you > > could > > > > > > provide > > > > > > > > > either the original code, or a quickstarted project that I > > can > > > > > > download > > > > > > > > that > > > > > > > > > reproduces the problem in as few extra lines of code as > > possible. > > > > > > > > > Troubleshooting is much easier then. > > > > > > > > > > On Wed, Feb 23, 2011 at 7:28 AM, Vineet < > > > > [email protected]> > > > > > > > > wrote: > > > > > > > > > > Hi ! > > > > > > > > > > For learning purpose, I have taken a single database-table. > > > > > > > > > > So the code is quite small & can be reproduced here. > > > > > > > > > > (Some standard defs generated by quickstart are not > > reproduced > > > > > > here). > > > > > > > > > > > A nice table with data-rows is rendered by visiting-- > > > > > > > > > > "http://localhost:8080/color/" > > > > > > > > > > > But, > > > > > > > > > > 1] The links to next pages are not working. > > > > > > > > > > After clicking the links, "Default" page is rendered. > > > > > > > > > > > 2] Which method(s) need to be customized (& where it can be > > > > found) > > > > > > in > > > > > > > > > > order to--- > > > > > > > > > > A] filter the records to display. > > > > > > > > > > B] customize Add/Edit forms rendering(I have understood how > > to > > > > > > define > > > > > > > > > > forms thro' sprox) > > > > > > > > > > > ========== \model\color.py ============= > > > > > > > > > > --This maps to a MySQL table named 'clr' in database > > 'whl'-- > > > > > > > > > > > from sqlalchemy import Column > > > > > > > > > > from sqlalchemy import Text, Integer, String > > > > > > > > > > > from mwhl.model import DeclarativeBase > > > > > > > > > > > class Color(DeclarativeBase): > > > > > > > > > > > __tablename__ = 'clr' > > > > > > > > > > > clrid = Column(Integer, primary_key=True) > > > > > > > > > > frid = Column(Integer) > > > > > > > > > > clrnm = Column(String(50)) > > > > > > > > > > clrcd = Column(String(25)) > > > > > > > > > > active = Column(Text) > > > > > > > > > > > ========== \development.ini ============= > > > > > > > > > > > sqlalchemy.url=mysql://root:123@localhost:3306/whl > > > > > > > > > > templating.mako.reloadfromdisk = true > > > > > > > > > > templating.mako.compiled_templates_dir = > > > > %(here)s/data/templates > > > > > > > > > > > ========== \controllers\root.py ============= > > > > > > > > > > > from tg import expose, flash, require, url, request, > > redirect, > > > > > > > > > > tmpl_context > > > > > > > > > > from mwhl.widgets.clr_form import create_clradd_form > > > > > > > > > > from pylons.i18n import ugettext as _, lazy_ugettext as l_ > > > > > > > > > > from tgext.admin.tgadminconfig import TGAdminConfig > > > > > > > > > > from tgext.admin.controller import AdminController > > > > > > > > > > from repoze.what import predicates > > > > > > > > > > > from mwhl import model > > > > > > > > > > from mwhl.lib.base import BaseController > > > > > > > > > > from mwhl.model import DBSession, Color > > > > > > > > > > from mwhl.controllers.secure import SecureController > > > > > > > > > > > from mwhl.controllers.error import ErrorController > > > > > > > > > > > from tgext.crud import CrudRestController > > > > > > > > > > from sprox.tablebase import TableBase > > > > > > > > > > from sprox.fillerbase import TableFiller > > > > > > > > > > > __all__ = ['RootController'] > > > > > > > > > > > class ColorTable(TableBase): > > > > > > > > > > __model__ = Color > > > > > > > > > > __omit_fields__ = ['frid'] > > > > > > > > > > color_table = ColorTable(DBSession) > > > > > > > > > > > class ColorTableFiller(TableFiller): > > > > > > > > > > __model__ = Color > > > > > > > > > > color_table_filler = ColorTableFiller(DBSession) > > > > > > > > > > > class ColorController(CrudRestController): > > > > > > > > > > model = Color > > > > > > > > > > table = color_table > > > > > > > > > > table_filler = color_table_filler > > > > > > > > > > > class RootController(BaseController): > > > > > > > > > > > secc = > > ... > > read more » -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

