Re: custom admin view for edit_inline object

2006-02-11 Thread Robert Wittams
> Okay, I get it now. Sorry, I need to read more carefully. It would save > me a lot of time. > > Colleen No worries, just glad someone is finding this stuff useful ;-) Robert

Re: recursive template calls

2006-02-11 Thread Robert Wittams
Shannon -jj Behrens wrote: >> You don't *need* recursion on templates for threaded messages like >>your example app, that's exactly the point :) > > > Julio, with all due respect for your programming prowess, I *like* > recursion. It can often make hard problems easy, even when generating > HT

Re: custom admin view for edit_inline object

2006-02-11 Thread Robert Wittams
Colleen Owens wrote: > On 09 Feb, 2006, at 13.21, Robert Wittams wrote: > > > > I'd be happy to write this up once I get it working. The problem I'm > having right now is that there seems to be no elegant way of updating > the dictionary bound_related_object_

Re: custom admin view for edit_inline object

2006-02-09 Thread Robert Wittams
Colleen Owens wrote: >>Did you read the line: >> >>Inline editing can be customised. rather than using >>edit_inline=meta.TABULAR or meta.SOURCE, you can define a custom inline >>editing mode. This is done by subclassing BoundRelatedObject?, and using >>that class. eg edit_inline=HorizontalScrolle

Re: custom admin view for edit_inline object

2006-02-09 Thread Robert Wittams
Colleen Owens wrote: >>There is a simple way to create special admin templates for one object. >>See >>http://code.djangoproject.com/wiki/NewAdminChanges#Adminconvertedtoseparatetemplates >> >>HTH, >>Edgars > > > Thanks for the link, I hadn't seen this before. I basically derived the > same solu

Re: one to many confusion

2006-01-29 Thread Robert Wittams
Adrian Holovaty wrote: > On 1/29/06, Pasi Savolainen <[EMAIL PROTECTED]> wrote: > >>class Foo (meta.Model): >> name = meta.CharField (maxlength=100): >> def __repr__(self): >> return name; >>- - >> >>note missing 'self.' from __repr__. >> >>The surprising result was that I got a _

Re: Duplicate object

2006-01-12 Thread Robert Wittams
Adrian Holovaty wrote: > On 1/12/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > >>On Jan 12, 2006, at 8:09 AM, Simon Willison wrote: >> >>>Maybe it would be useful for all Django model objects to gain >>>themselves a duplicate() method which does exactly this - returns >>>an identical object

Re: Livepage-like functionality?

2005-12-28 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > I've spent some time experimenting with Nevow's LivePage (aka LiveEvil) > fuctionality that allows the server to "send" events to the web page. > It seems to do this by doing an AJAX-style request to the server, and > then the server doesn't send any data back until eith

Re: admin interface: how to give read-only access?

2005-12-27 Thread Robert Wittams
Emanuele wrote: > Hi, > I'd like to give read-only access to some objects in admin interface to > selected users. I know that django admin interface is CRUD and I can > give only create/update/delete permissions to users, but is there a way > to solve my problem (other than creating my templates a

Re: admin-interface: some questions

2005-12-27 Thread Robert Wittams
Adrian Holovaty wrote: > > >>- we have automatic fields for createdate and updatedate (auto_now, >>auto_now_add). what about automatically inserting the logged in user who >>creates (or updates) the record? i don´t know about anybody else, but i need >>that all the time. that´s especially intere

Re: troubles with admin interface

2005-12-26 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi! > > After reading tutorial about Django, try to write simple app. App > contain only one model: > class PressureRecord(meta.Model): > record_date = meta.DateField() > record_time = meta.TimeField() > sys_press = meta.IntegerField() > dia_press = meta

Re: ChangeManipulator doesn't work

2005-12-23 Thread Robert Wittams
PythonistL wrote: > Robert, > Thank you for your reply. > I am not still an expert( only a beginner) on Django. I tried to copy > the example from > http://www.djangoproject.com/documentation/forms/ > and there was no mention about manipulator.flatten_data() . > Is there any example /description

Re: ChangeManipulator doesn't work

2005-12-23 Thread Robert Wittams
PythonistL wrote: > Robert, > no manipulator.flatten_data() is not nescessary for that. But, it is extremely stupid not to use it, because that will cause your form to break if you use any of a wide number of features : foreignkeys, dates, inline editing, raw_id admin, etc etc. It pretty much

Re: ChangeManipulator doesn't work

2005-12-23 Thread Robert Wittams
> (FYI, the method I was referring to is created by "magic", and has > probably already been removed from the magic-removal branch. It is > django.core.meta.manipulator_flatten_data(), but since this is tied so > closely into the admin code it probably wouldn't do much for you. Sorry > to send you

Re: Problem in Admin section, in shell works great

2005-12-21 Thread Robert Wittams
Burhan wrote: > class META: > admin = meta.Admin( > list_display=('name','price'), > list_filter=('price'), This list_filter value is not a tuple. It is just a string in brackets. This means that we iterate th

Re: list_display and ForeignForeignKey

2005-12-17 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Please take a look at this: > > from django.core import meta > from django.models.core import sites > > class Group(meta.Model): > site = meta.ForeignKey(sites.Site) > > class Product(meta.Model): > group = meta.ForeignKey(Group) > class META: >

Re: Comments on Ruby code slides from Snakes and Rubies?

2005-12-14 Thread Robert Wittams
braver wrote: > A symbol which is a unique string is not the story here, it turns out > -- dynamic language is! > > has_many :milestones > > is apparently a call which generates code inside of the class! Can it > be replicated in python for ORM purposes? > > Not really. Read up on metaclasse

Re: Django screencast

2005-12-13 Thread Robert Wittams
Great! Shame we're going to break the apis ;-) So a couple of points - * the app template loader would probably have seemed less tedious than the full path thing. Ie just 'templates' in the app directory. Things that might be worth showing in a slightly longer screencast: Templates: * T

Re: Calling templates within templates - a'la Mason

2005-12-12 Thread Robert Wittams
Joel wrote: > I gave django a try at work to develop a survey application. Turned out > pretty sweet, I felt very productive and spent most of my time > concentrating on survey tasks. I felt frustrated twice, these are the > hurdles I faced that I feel I have probably missed obvious solutions > >

Re: Easy customizing of admin subsections?

2005-12-11 Thread Robert Wittams
tonemcd wrote: > Whoa, this is very neat... > > I see the /admin/csv_thing/ URL getting dispatched to (presumably) a > method in the target app, - is this correct? > > If so (big drum roll here), does that mean a method in my_app can get > the content of 'result_list' from change_list.html, and

Re: admin/change_form broken ?

2005-12-10 Thread Robert Wittams
olive wrote: > In template > C:\soft\Python24\lib\site-packages\django\contrib\admin\templates\admin/change_form.html, > error at line 80 > 'block' tag with name 'extrahead' appears more than once > 70 > 71{% endfor %} > 72{% endif %} > 73{% endif %} > 74{% endif %} > 75 >

Re: TimeField Problem/Question

2005-12-08 Thread Robert Wittams
Brett Hoerner wrote: > Robert Wittams wrote: > >>both auto_now and auto_now_add are quite hackish little puppies. >> >>auto_now should really be equivalent to a _pre_save that sets the field >>to the current time. >> >>auto_now_add should really be equi

Re: TimeField Problem/Question

2005-12-08 Thread Robert Wittams
both auto_now and auto_now_add are quite hackish little puppies. auto_now should really be equivalent to a _pre_save that sets the field to the current time. auto_now_add should really be equivalent to a non-editable field that gets set to the current time on insert, and is just statically displ

Re: delete(), cascade, and the case of the missing data

2005-12-05 Thread Robert Wittams
There really is no sensible way around the requirement for transactions, unless you want to check every constraint yourself. It is planned to go in before 0.91, AFAIK.

Re: Easy customizing of admin subsections?

2005-12-04 Thread Robert Wittams
> Yep, this worked, thanks, except that it was > admin//change_list.html (or my_app, dunno, name is the same, > anyway just one subdir needed, not one), Both should work. > and of course no .html Doh! ;-) > extension in "extends". Good stuff. >

Re: Easy customizing of admin subsections?

2005-12-04 Thread Robert Wittams
Jaanus wrote: > Hi, > > Django is cool :-) Im currently looking at it to possibly use it in > several high-profile initiatives. So far so good. > > One thing I came across is a question of whether I can easily customize > subsections of admin. Now the tutorials explain it nicely about > admin_ba

Re: Contrib markup app not to be installed?

2005-12-03 Thread Robert Wittams
Ian Holsman wrote: > shouldn't a warning/informational message be generated in this case. > something like > > $ django-admin install markup > INFO: no models found to install.. skipping markup > > ? Given that the command acts on a model module, *not* on an app, this wouldn't work. It will ins

Re: AddManipulator does not populate select

2005-12-03 Thread Robert Wittams
Robert Wittams wrote: > Maniac wrote: > >>Robert Wittams wrote: >> >> >>>Why are you flattening the data again? You only do this once, when >>>extracting the data out of the object instance (or the defaults). The >>>data is already 'flat

Re: AddManipulator does not populate select

2005-12-03 Thread Robert Wittams
Maniac wrote: > > Robert Wittams wrote: > >> Why are you flattening the data again? You only do this once, when >> extracting the data out of the object instance (or the defaults). The >> data is already 'flat' when it comes out of a POST. do_html2python get

Re: AddManipulator does not populate select

2005-12-03 Thread Robert Wittams
Kenneth Gonsalves wrote: > On Saturday 03 Dec 2005 4:48 pm, Robert Wittams wrote: > >>Kenneth Gonsalves wrote: >> >>>hi, >>>when using AddManipulator and returning the form for correcting >>>errors, the select field does not get populated with the

Re: Contrib markup app not to be installed?

2005-12-03 Thread Robert Wittams
James Bennett wrote: > While setting up a new project tonight, I was running through and > doing a 'django-admin.py install' for each of the apps from > django.contrib I'll be using, and when I got to the markup app, I got > the following error: > > Error: No module named markup. Are you sure you

Re: AddManipulator does not populate select

2005-12-03 Thread Robert Wittams
Kenneth Gonsalves wrote: > hi, > when using AddManipulator and returning the form for correcting > errors, the select field does not get populated with the choice > selected. I could do this manually, but does django have a way of > doing it automatically? If using trunk, are you using flatten

Re: Declare a variable in a template

2005-12-02 Thread Robert Wittams
> @inclusion_tag("myapp/menu") That should be @register.inclusion_tag("myapp/menu")

Re: Declare a variable in a template

2005-12-02 Thread Robert Wittams
Jiri Barton wrote: > Hello there, > > I have the following problem. Here's my template fragment; it defines a > menu: > > > mushrooms > cheese > tomatoes > onion > > > Now, I'd like to be able to highlight one item in some templates, and > another item in other templates. Only

Re: Customising new-admin tags

2005-11-30 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi > > I know this has been talked about before but I'm having real trouble > getting a handle on customising template tags > > What i want to do is alter the admin change list screen to show some > related values. Now the python's easy it's just a couple of lines in >

Re: customizing admin

2005-11-28 Thread Robert Wittams
Medium wrote: > > hi, > > i'm very new to django (basically a few days) and have read almost all > the docs, wikis and mailing list archives (well the topics which > interest me at least). I have a few questions I was hoping anyone on the > list could help me with concerning customizing the beha

Re: "Please correct the errors below." is displayed without actual errors

2005-11-27 Thread Robert Wittams
Ksenia wrote: > Hi, > > I have quite a big form, with all kind of fileds. All fields might be > blank, so i use everywhere blank=True and with integer- float- and > datefields also null=True. > When I am trying to save existed record, I get the message "Please > correct the errors below.", but no

Re: generic views + new admin templates

2005-11-27 Thread Robert Wittams
stava wrote: > I'm trying to use generic views together with the newly separated admin > templates, but it's failing miserably. > > I specify the generic view I want to use in url.py: > countries = { > 'app_label': 'ttime', > 'module_name': 'countries', > } > urlpatterns = patterns('', > (r

Re: Per-user data: any pointers?

2005-11-27 Thread Robert Wittams
David Ascher wrote: > I'm trying to figure out how best to do per-user data (think of the > relationship between users and her photos on flickr). > > I notice that there's a nifty concept of "permissions", which in some ways > is per-user binary data. There is also the mostly undocumented (?) >

Re: Bi-Directional ManyToMany

2005-11-23 Thread Robert Wittams
plisk wrote: > Anyone working on this ? Would be great to have such functionality, so > if noone started to do it i could give a look. Also where will this > bidirectional ManyToMany select appear in itemtypes, below all the > controls it has in model ? > > I am working on core-fields removal a

Re: 20 minute wiki, sortof.

2005-11-20 Thread Robert Wittams
Simon Willison wrote: > > > On 18 Nov 2005, at 15:26, Robert Wittams wrote: > >> Hm, maybe when DEBUG is on, CommonMiddleware should put up an >> interstitial page to tell the developer what is happening? It does seem >> to bite a lot of people. > >

Re: Bi-Directional ManyToMany

2005-11-18 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi > > I've just defined a manytomany relationship in the following way > > class ItemType(meta.Model): > name = meta.CharField(maxlength=100) > descritpion = meta.CharField(maxlength=250) > > class PropertyType(meta.Model): > name = meta.CharField(maxleng

Re: 20 minute wiki, sortof.

2005-11-18 Thread Robert Wittams
David Ascher wrote: > Stumbling blocks: > * figuring out that I had to do "import > django.contrib.markup.templatetags.markup" to get the markup filters > registered was harder than it should have been. Did {% load markup %} not work? Maybe this tag needs to be pointed out more prominently - it is

Re: why pub_date is split to pub_date_date and pub_date_time

2005-11-16 Thread Robert Wittams
limodou wrote: >>This isn't very well documented right now. >>See "http://www.djangoproject.com/documentation/model_api/";, under >>DateTimeField: >> >>"the admin represents this as two fields, with >>JavaScript shortcuts. " > > > But there are no JavaScript shortcuts in output code of generic

Re: why pub_date is split to pub_date_date and pub_date_time

2005-11-16 Thread Robert Wittams
limodou wrote: >>Fields can create multiple FormFields. > > > So you mean Fields is not the same as FormFields, and the splited > FormFields can be combine again as auto saving to DB? But if I want to > manually create a form in template, what rule should I followed with ? > Is there some docume

Re: why pub_date is split to pub_date_date and pub_date_time

2005-11-16 Thread Robert Wittams
limodou wrote: > I want to use generic view to create my model polls's form html code, > but I found pub_date is split to pub_date_date and pub_date_time, I > want to know if there are some documents remind this. I used below > code: > > {% for field in form.fields %} > {{field}} > {% endfor %} >

Re: understanding regroup

2005-11-15 Thread Robert Wittams
Sean Perry wrote: > > I have the following classes in my model: > > class Category: > description = charField() > > class Thing: > self.description = charField() > self.category(ForeignKey, Category) > > I would like a page layed out like: > > Category1 > * foo > * bar > * baz >

Re: Repeating Blocks Within a Template

2005-11-14 Thread Robert Wittams
Simon Willison wrote: > > > On 14 Nov 2005, at 06:06, Tom Tobin wrote: > >> A bit stumped here . . . Is there a recommended convention for >> repeating blocks within a template? e.g., I have a paginated >> object_list generic view, and I want to repeat my pager code (i.e., >> "back", "next")

Re: use admin features in external applications

2005-11-14 Thread Robert Wittams
tonemcd wrote: > Thanks for the info Robert - I was aiming at using some of the forms > etc. functionality from the admin interface in my own applications > (trying to not re-invent the wheel). > > I will have a look around the admin_list.py code and see whether I can > pick things up from there.

Re: use admin features in external applications

2005-11-13 Thread Robert Wittams
frank h. wrote: > hello, > how can i reuse some features of the admin app in my external > applications? > the search_fields and date_hierarchy features are so nice! > is there a simple way? > -frank > > Your best bet is the new-admin branch. However, the particular features you have mentioned

Re: use admin features in external applications

2005-11-13 Thread Robert Wittams
tonemcd wrote: > I hate to do this, but - me too! > > I've svn'ed the new-admin branch in the hope that it would be easier to > do it from that checkout, but no joy as yet. > > Not really sure what you want to do, so I hope the reply to frank h will help you too.

Re: New-admin problem

2005-11-11 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Incredible. I checked this out yesterday and it was revisions 1157 > > This morning, 1168, things are really moving fast on this branch > > Thanks this version doesn't have the same problem > > This was due to me forgetting to save/commit a few files after merging A

Re: Running new-admin branch with trunk

2005-11-10 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi > > I currently have the trunk django running a little prject on my server > (it's working well its a great product) > > However when I come to make a second application some of the things I > need to do I'm told are only possible in the new admin branch. > > I nee

Re: Editing inline object individually

2005-11-07 Thread Robert Wittams
Adrian Holovaty wrote: > On 11/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >>It's a bit of a problem for me because i want to do this. >> >>Allow users to create a Purchase Order which has several Items (of >>equipment) so item's are edited inline with purchase orders. >> >>Then for each

Re: I want to start a django project for a forum

2005-10-31 Thread Robert Wittams
Ian Holsman wrote: > is anyone else interested in joining? I was thinking of similar to > what phpBB does. > > If so I propose we open up a sourceforge project, or perhaps we could > even host it on code.djangoproject.com if they let us ;-) > > any volunteers? > > regards > Ian > > -- > [EMAIL

Re: Do's and Dont's for Application Writers

2005-10-20 Thread Robert Wittams
kmh wrote: >>On 10/20/05, kmh <[EMAIL PROTECTED]> wrote: >> >>>Shouldn't we encourage a model where site templates are able to >>>explicitly "include" application templates, rather than the other way >>>around? > > >>On 10/20/05, Sune Kirkeby <[EMAIL PROTECTED]> wrote: >>That's not how applicati

Re: Manipulators that span a relationships?

2005-10-15 Thread Robert Wittams
Ian Maurer wrote: > I didn't get very far with the new branch. My template is failing to > render right off the bat... I haven't had a chance to investigate > this, but my templates were/are working just fine under the main > branch. Below is the end of my traceback... any thoughts? > > -ian > >

Re: Manipulators that span a relationships?

2005-10-14 Thread Robert Wittams
Ian Maurer wrote: > I didn't get very far with the new branch. My template is failing to > render right off the bat... I haven't had a chance to investigate > this, but my templates were/are working just fine under the main > branch. Below is the end of my traceback... any thoughts? > > -ian I c

Re: templates with multiple repeating blocks

2005-10-14 Thread Robert Wittams
Alice wrote: > thanks :) > > did anything ever come of it? > > I agree that if a clean implementation cannot be done, it shouldn't. > There was another interesting idea that a block could be referenced as > a variable > > {% block content %} > {% endblock %} > > {{ content }} > > or perhaps >

Re: LIST[object.attribute] lookup in template

2005-10-14 Thread Robert Wittams
Andreas Stuhlmüller wrote: > Robert Wittams wrote: > >>I can't really work this out without more information. Could you file a >>ticket with a minimal example. ( or at least include a backtrace. ) > > > I didn't expect you to solve the probl

Re: LIST[object.attribute] lookup in template

2005-10-14 Thread Robert Wittams
Andreas Stuhlmüller wrote: > Robert Wittams wrote: > >>Alternatively, the easy way to do this would be to use >>template_decorators.py from the new-admin branch > > > The simple tag decorator looks like an extremely useful enhancement. At > the moment I'm not

Re: Manipulators that span a relationships?

2005-10-13 Thread Robert Wittams
Ian Maurer wrote: > That's a pretty slick implementation, I'd like to try it out... some > questions: > > Is it in a usable format? > Are there any directions for pulling this branch down to my local environment? > What happens if the main branch gets updated? > > > thanks... > ian > > > W

Re: Manipulators that span a relationships?

2005-10-13 Thread Robert Wittams
Ian Maurer wrote: > Is there a way to create a manipulator that will span a foreign key > relationship, similar to the "edit_inline" feature in the Admin tool? > > I know I cannot leverage the edit_inline feature now (ticket #535 may > fix that) but is there a "smart" way of leveraging the valida

Re: LIST[object.attribute] lookup in template

2005-10-13 Thread Robert Wittams
Andreas Stuhlmüller wrote: > Hi Adrian, > > >>In your case, pass ITEM_NAMES[item.type] >>to the template context. > > > Easier said than done. The template was intended to do something like > this: > > {% for item in items %} > {{ ITEM_NAMES[item.type] }} > {% endfor %} > > Is it possibl

Re: Admin three levels deep

2005-10-06 Thread Robert Wittams
> > > Hm, I don't know how you're implementing it (maybe I'll switch to the > new-admin trunk tomorrow, just to take a look), but I think you can > implement it fairly simply without the problems you describe above. Well, it is not implemented fully yet. The main changes for this will be in djan

Re: Admin three levels deep

2005-10-06 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi there, > > I'm very new to Django and I'm learning it by adapting the stuff from > the tutorial to a new (test) application, a Forum. The tutorial nicely > explains that you don't want "Polls" and "Choices" in the main menu, > because "Choices" is a part of "Poll". W

Re: serving PDF

2005-09-30 Thread Robert Wittams
David S. wrote: > I am wondering how best to serve PDF files in Django. > > I am using ReportLab to generate a file. > > So should I name it and place it where the server can fetch it? > > Does the URL have to end in pdf for it to be handled by the browser? > > Can I configure the develo

Re: Javascripts for forms, onchange etc

2005-09-29 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi All > > I would like to be able to implement onchange functionality for form > fields in my django app. > > My app has a Questions Module which has related Module Answers edited > inline (just like in django admin) > > Questions can be correct or incorrect and only

Re: Controlling which fields to display when editing an object inline

2005-09-28 Thread Robert Wittams
Adrian Holovaty wrote: > On 9/28/05, Robert Wittams <[EMAIL PROTECTED]> wrote: > >>However, the patch I have been making to clean up the admin and >>metasystem, on ticket #535, includes a feature that may help. >> >>Rather than doing edit_inline=meta

Re: Controlling which fields to display when editing an object inline

2005-09-28 Thread Robert Wittams
mortenbagai wrote: > Hello, > > I have two model objects, Section and Page. Each Page is mapped to a > Section through a regular ForeignKey field. On the Section edit detail > display in the Django admin app, I'd like to list the Page objects > belonging to that Section and having a few fields be

Re: Problem With Image Field

2005-09-25 Thread Robert Wittams
Have you got PIL installed? http://www.pythonware.com/products/pil/

Re: Table-less model as base class?

2005-09-18 Thread Robert Wittams
Adrian Holovaty wrote: > On 9/18/05, Eric Walstad <[EMAIL PROTECTED]> wrote: > >>I'd like to make a base class for my model classes that defines some >>fields but doesn't result in a table in the database. If my base class >>is derived from meta.Model, then django makes a table for it in the >>d

Re: befuddled with formfields.py

2005-09-18 Thread Robert Wittams
scottpierce wrote: > See http://code.djangoproject.com/ticket/338. The patch works. > > Scott Pierce > > So basically, mainipulators are completely useless when it comes to ForeignKeys and ManyToManys and need to be hacked around in the view function? This is a horrible fix. I'm going to fix

befuddled with formfields.py

2005-09-16 Thread Robert Wittams
I have a problem wherein no select field is prepopulated in any update form, or a create form where I provide some already filled fields. I investigated this, and now I have no idea how this has ever worked : in http://code.djangoproject.com/browser/django/trunk/django/core/formfields.py#l114

Re: Name in admin for Foreign Key's

2005-09-08 Thread Robert Wittams
Milton Waddams wrote: > I'm trying to associate multiple users with a team and each user having a > specific role within that team. > > eg. not my situation though easiest way to make it clear what I'm attempting > to achieve... > CEO = meta.ForeignKey(User) > CFO = meta.ForeignKey(User) > > w