On Mon, 26 Aug 2013 16:25:42 -0300 Bruno Galindro da Costa <bruno.galindro(a)gmail.com> wrote:
> I need to add a roomid that has more than 30 chars.
>
> I've altered the size of rommid column in table room (at database level),
> but the HTML fields has a 30 chars limitation.
>
> Nav web has built on Django framework which is very nice ;), but I don't
> know where I can make this modification.
The Django model Room is defined in the Python module nav.models.manage.
The max_length attribute is set to 30 there. Modifying data model would
require a SQL changescript under the `sql/changes/` directory, and a
change to the Room model class.
The Location/Room data models are modeled after the scheme used at NTNU
(from which NAV originated). NTNU has multiple campuses and locations,
but all wiring closets are identified by a unique 3 digit number (which
makes the limit of 30 characters seem immense).
That being said, the 30 character limit is entirely artificial. The
database field is of the type VARCHAR, and could be changed to have no
limit at all. However, since this string is a primary key, having it be
a huge string isn't a good way to normalize the schema.
> My sugestion is:
>
> 1 - add a field called Location in Edit IP Device screen which filters the
> Room field.
> 2 - add Location and Parent Organization information at IP Device Info.
>
> We can help you and your development team to make these modifications (and
> maybe others). This could be a nice starting.
IIUC, your use case is that you have so many rooms in your database,
that the Room dropdown box for editing IP Devices is overpopulated?
John-Magne has suggested something like this component:
http://ivaynberg.github.io/select2/ - I.e. a hierarchical
(Location/Room), searchable dropdown.
I'm Cc:ing nav-dev, since your getting into development territory with
this question.
--
Morten Brekkevold
UNINETT