Re: create models from the admin page?

2006-05-05 Thread Glenn Tenney

On Fri, May 05, 2006 at 12:20:35PM -0500, James Bennett wrote:
> Keep in mind that's a wiki that *anyone* can contribute to, not just
> "official" developers ;)

And... because it's a wiki... have their contributions deleted too.
(mine were)

-- 
Glenn

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-05 Thread falcon

It looks like I'm not the only one thinking about these ideas, Django
devs themselves have proposed  this as one of the ideas for SOC coders:
"create a project and super user with one command line statement, fire
up the development web server, and import/create/refine your model
using live data from directly within the django auto admin."
(http://code.djangoproject.com/wiki/SummerOfCode2006)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-05 Thread julián

A web-based model editor is not an easy task. I think vi is the right
modeller tool (after a paper/pencil session)  or emacs if you're a
pianist.

For GUI-tools-aficionados I'd rather devote the effort to write code
generators for apps like umbrello
[http://uml.sourceforge.net/index.php]. A lot easier. A lot more
useful. 

j.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-03 Thread James Bennett

On 5/3/06, falcon <[EMAIL PROTECTED]> wrote:
> By users I meant users of the Django framework, not end-users.  Since
> my last post I came across a few models (the ones you suggested) that
> do have a great deal more logic than I expected.  I still believe that
> many 'developers' could benefit from defining simple to moderately
> complex models on the web.  If code needs to get more complex,
> developers can just switch back to using models.py.

And I still really think it's something that would, in the end, lead
to sloppy model design (because of the "oh, we can just go back into
the web interface and fix it") and rash decision making. Also, if it's
*possible* to create and edit models through a web interface, a CEO
somewhere is going to demand that his user account have permissions to
do so. So long as it requires writing Python code (and not
particularly difficult Python code at that), this won't be a problem
;)

Also I really don't think there's any way to do this that would truly
do justice to the possibility of Django's model system without
becoming more confusing and complex than writing a few lines of clean
Python code -- look back through the model documentation sometime and
glance at just how many options are available (not just in terms of
field types, but in the optional arguments they can take).

> As far as I can tell, part of Django's motivation is that the
> repetitive parts of the development cycle should be made easy and
> quick.  I have written many applications which were nothing more than
> taking data form a database and putting it on the web...nothing
> complex.  Something like what I propose would make web apps trivial.
> As far as developers getting bad habits because of the ease of creating
> and changing models...doesn't that make Django itself Bad(TM)?

Grabbing records from the database is something that has to happen
thousands of times over the course of an application's life, so Django
makes it easy and automatic to do that. Passing data into a template
is something that has to happen thousands of times over the course of
an application's life, so Django makes it easy and automatic to do
that. Defining the data models is something that only happens a few
times (and, hopefully, really only once or twice) over an
application's lifetime, so the level of "triviality" isn't as high
here -- it's an important, fundamental thing which significantly
affects the application, and I think having to write a few lines of
Python is a good way of reminding developers of that.

And Django already makes it trivial to write a generic web
application. Django doesn't make it trivial to change an existing
model with data already stored in the DB (and despite repeated
discussions of schema evolution techniques, I'm still not 100% certain
it ever should).

And, really, writing a few lines of Python isn't a terrible burden for
a developer working with a Python framework. As much as I like some of
the promotion Django has been getting this week as a framework that's
easy for non-programmers, I think that if you're doing anything
serious with it you should have someone who's a programmer.

> I wasn't able to find an outline of the most important classes and how
> they relate to each other, from the perspective of a django framework
> developer.

Read the model definitions ;)

Seriously, though, that's something to be addressed through
documentation, not through web-based model creation.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-03 Thread Rock


falcon wrote:
>  I still believe that
> many 'developers' could benefit from defining simple to moderately
> complex models on the web.  If code needs to get more complex,
> developers can just switch back to using models.py.
>

I have gone in a different direction. I have written a tool to parse
the models file and use that info (along with some hints that I embed
in comments) to generate rules to drive pre-existing data extraction
software. I then use the same info to generate code that takes the
results of the data extraction process and loads it into the Django
database. (The loader runs continuously as I manage data coming in from
factories that run 24/7/365 at several locations around the globe.)

I am still proving this stuff out and tuning performance, but the early
experiements have worked out well. I am contemplating the possibility
of recasting this code into a mini-framework that could conceivably be
contributed to the Django project in the future.

My other challenge, which is only partially implemented at this moment,
is automating the cloning process. Before I change my models using the
tools above, I want to clone my existing Django system to another
server (database and all) so that my users can keep using a static
snapshot of my system even as I reload the factory data and create new
views for the newly added model fields. Ideally I would also configure
Apache to send the user to the right server depending on the state of
the main system.

Fun stuff, eh? Hard to believe I get paid to do this stuff.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-03 Thread Sean Perry

James Bennett wrote:
> Going further, it seems to me that, rather than encouraging the design
> of good, well-thought-out models, building models through a web
> interface would encourage a slapdash "if we get it wrong we'll just go
> into the web interface and change it" mentality, which would be a
> certifiable Bad Thing(TM).
> 

+1,

Besides this only gets you the models and really simple views. Real 
working apps really do need some code. I don't see what the time spent 
on adding models to the admin UI would save long term.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-03 Thread falcon

James,
Thanks for pointing to sites/models.py and auth/models.py, I'll take a
look.

I wonder if you could say a few more words about why you think such a
system will be abused?  As far as I can tell, the models.py interface
is simple enough to be ported completely to the web (it doesn't look
like models.py is where you put complicated logic).  If anything, users
could receive immediate feedback rather than having typos or syntax
errors show up when only when they try to load the page (as I'm going
through right now).


James Bennett wrote:
> On 5/3/06, falcon <[EMAIL PROTECTED]> wrote:
> > I just started looking at Django, looks very interesting.  However,
> > couldn't models be defined in the admin page, rather than in python
> > code?  In fact, is there a reason why we couldn't download django, run
> > the embedded web server, go to the admin page and do every thing there
> > (except templates)?
>
> I can't speak for anyone else, but I'd personally be against it mostly
> because (the difficulty of building something like that
> notwithstanding) I think it would encourage a lot of bad usage habits
> and bad development practices.
>
> > I looked into django/contrib/admin/models.py, I expected to find models
> > for groups, users, sites, etcbut all I found was "class
> > LogEntry(models.Model):."  In other words I probably won't be able to
> > make my suggested changes myself :) (I'm not only a django newbie but
> > also a python newbie).
>
> The user and group models are in django/contrib/auth/models.py, sites
> in django/contrib/sites/models.py. The admin app draws on those and
> adds logging and a pretty interface.
>
> --
> "May the forces of evil become confused on the way to your house."
>   -- George Carlin


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: create models from the admin page?

2006-05-03 Thread James Bennett

On 5/3/06, falcon <[EMAIL PROTECTED]> wrote:
> I just started looking at Django, looks very interesting.  However,
> couldn't models be defined in the admin page, rather than in python
> code?  In fact, is there a reason why we couldn't download django, run
> the embedded web server, go to the admin page and do every thing there
> (except templates)?

I can't speak for anyone else, but I'd personally be against it mostly
because (the difficulty of building something like that
notwithstanding) I think it would encourage a lot of bad usage habits
and bad development practices.

> I looked into django/contrib/admin/models.py, I expected to find models
> for groups, users, sites, etcbut all I found was "class
> LogEntry(models.Model):."  In other words I probably won't be able to
> make my suggested changes myself :) (I'm not only a django newbie but
> also a python newbie).

The user and group models are in django/contrib/auth/models.py, sites
in django/contrib/sites/models.py. The admin app draws on those and
adds logging and a pretty interface.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---