Re: Additional Javascript include in ModelAdmin

2009-03-22 Thread Daniel Roseman
to use a rich-text editor (NicEdit) instead of the plain > memo box. > > Thanks! http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-media-definitions -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Additional Javascript include in ModelAdmin

2009-03-22 Thread Roy
Hi, Is there a way to include additional JavaScript in the admin page for a particular model? I don't want to touch the model code though. The particular scenario is I want to change the flatpage edit screen in the admin to use a rich-text editor (NicEdit) instead of the plain memo box. Thanks!

Re: ModelAdmin get_urls w/ invalid literal for int() with base 10

2009-03-05 Thread Brian Neal
ut I noticed a new get_urls function on > > the ModelAdmin class in the docs. I'm on trunk, and just did an svn > > update to 9975 to try this out. > > > The docs for get_urls show the view being registered as self.view. Is > > that possible to register a class m

Re: ModelAdmin get_urls w/ invalid literal for int() with base 10

2009-03-04 Thread Brian Neal
attern. But I noticed a new get_urls function on > > the ModelAdmin class in the docs. I'm on trunk, and just did an svn > > update to 9975 to try this out. > > > The docs for get_urls show the view being registered as self.view. Is > > that possible to register a c

Re: ModelAdmin get_urls w/ invalid literal for int() with base 10

2009-03-04 Thread Brian Neal
On Mar 4, 9:11 pm, Brian Neal wrote: > I'd like to make my own custom view. In the past I did this by > following the django book and added a URL to my main urlpatterns above > the '^admin/(.*)' pattern. But I noticed a new get_urls function on > the ModelAdmin clas

ModelAdmin get_urls w/ invalid literal for int() with base 10

2009-03-04 Thread Brian Neal
I'd like to make my own custom view. In the past I did this by following the django book and added a URL to my main urlpatterns above the '^admin/(.*)' pattern. But I noticed a new get_urls function on the ModelAdmin class in the docs. I'm on trunk, and just did an svn update

Re: Can I overwrite the ModelAdmin for User

2009-02-17 Thread Kevin Audleman
wrote: > > > > > Alex, > > > I managed to get it to work, and the column is even sortable! Thanks > > for your help. > > > Here's my code for reference for anyone else who comes across this > > post: > > > class UserAdmin(admin.ModelAdmin): > &

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Karen Tracey
dmin.ModelAdmin): > There are some extensions made to the default User ModelAdmin that you are going to miss unless you base your customized class off of auth's provided default UserAdmin. See: http://code.djangoproject.com/ticket/8916#comment:14 That ticket notes that change password, for exam

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Kevin Audleman
heers, > > > > Kevin > > > > > On Feb 16, 3:45 pm, Alex Gaynor wrote: > > > > > On Mon, Feb 16, 2009 at 6:27 PM, Kevin Audleman < > > > > kevin.audle...@gmail.com>wrote: > > > > > > > I've created a custom p

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Alex Gaynor
> kevin.audle...@gmail.com>wrote: > > > > > > > I've created a custom profile per the instructions in chapter 12 of > > > > > the book to give my user's fields like address1, address2, etc. > > > > > Currently when I log in to the a

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Kevin Audleman
e admin and want to update a user, I have > > > > to go to two separate pages: the User page to update core user fields, > > > > and the Profile page to update fields in the profiles. > > > > > I would like to overwrite the ModelAdmin for the User object and >

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Alex Gaynor
t; Currently when I log in to the admin and want to update a user, I have > > > to go to two separate pages: the User page to update core user fields, > > > and the Profile page to update fields in the profiles. > > > > > I would like to overwrite the ModelAdmin

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Kevin Audleman
chapter 12 of > > the book to give my user's fields like address1, address2, etc. > > Currently when I log in to the admin and want to update a user, I have > > to go to two separate pages: the User page to update core user fields, > > and the Profile page to upda

Re: Can I overwrite the ModelAdmin for User

2009-02-16 Thread Alex Gaynor
go to two separate pages: the User page to update core user fields, > and the Profile page to update fields in the profiles. > > I would like to overwrite the ModelAdmin for the User object and > inline the Profile object so that all fields for a user can be edited > from one page. Ho

Can I overwrite the ModelAdmin for User

2009-02-16 Thread Kevin Audleman
le page to update fields in the profiles. I would like to overwrite the ModelAdmin for the User object and inline the Profile object so that all fields for a user can be edited from one page. However django is throwing an error when I try to do so: AlreadyRegistered at /admin/ The model User

Re: [admin] can i use both a ModelAdmin and an Inline for the same model class? How?

2009-01-21 Thread Karen Tracey
On Wed, Jan 21, 2009 at 4:37 PM, TeenSpirit83 wrote: > > I'm developing a little webapp starting from the contrib.admin > at the moment i manage a class in the model with a modeladmin class > but i need to edit the entries as a tabular inline of another class. > if i write bot

[admin] can i use both a ModelAdmin and an Inline for the same model class? How?

2009-01-21 Thread TeenSpirit83
I'm developing a little webapp starting from the contrib.admin at the moment i manage a class in the model with a modeladmin class but i need to edit the entries as a tabular inline of another class. if i write both the inline and the modeladmin classes in admin.py and try to register them

Re: Using a model method in ModelAdmin fieldsets

2009-01-08 Thread Andy
).__init__(self, *args, **kwargs) ... self.fields['lastname'].initial = ... On Jan 8, 3:14 am, Andy wrote: > The better approach would be to specify a custom form in your > ModelAdmin.  This way your fieldset definition could include anything > that's speci

Re: Using a model method in ModelAdmin fieldsets

2009-01-08 Thread Andy
The better approach would be to specify a custom form in your ModelAdmin. This way your fieldset definition could include anything that's specified in your custom form. For Example: class SampleModel(models.Model): email = models.EmailField... firstname = models.CharField...

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
Thanks Karen & Daniel, I think your overiding approach will work. Thank you. Implemented a work around. I added extra fields (that persist my method information) to my model that I update and save when I do a listing. Price I pay is an extra database update each time the model is getting list

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread Karen Tracey
On Wed, Jan 7, 2009 at 11:45 AM, EagerToUnderstand wrote: > > What I try to achieve: > I have a couple of model methods that exposes real time information. > (Retrieved when method is called.) This is information I want to > display not only in the list_display, but also within the change view. >

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
..and therefor not visible to the fieldsets field? Still clear as mud? On Jan 7, 5:48 pm, Daniel Roseman wrote: > On Jan 7, 10:35 am, EagerToUnderstand wrote: > > > I am referencing a self defined model method in list_display option of > > ModelAdmin.  I would like to

Re: Using a model method in ModelAdmin fieldsets

2009-01-07 Thread Daniel Roseman
On Jan 7, 10:35 am, EagerToUnderstand wrote: > I am referencing a self defined model method in list_display option of > ModelAdmin. I would like to do the same in the fiedsets option of > ModelAdmin, but I get an error saying my method is missing from the > form when the page is r

Using a model method in ModelAdmin fieldsets

2009-01-07 Thread EagerToUnderstand
I am referencing a self defined model method in list_display option of ModelAdmin. I would like to do the same in the fiedsets option of ModelAdmin, but I get an error saying my method is missing from the form when the page is rendered. It seems to me I can only render model methods with

ModelAdmin and the ghost datas !

2008-12-23 Thread degans...@gmail.com
Hello :) (sorry I'm French) When I create a ticket (for a blog), I select various tags. I would save these with the save_model and save_tagged_items methods below : class TicketAdmin(admin.ModelAdmin): # ... def save_model(self, request, ticket, form, change): # Save the autho

ModelAdmin list_filter presets: usability best practice?

2008-12-15 Thread Jeff Kowalczyk
Does anyone have a best-practice suggestion for ModelAdmins which are best used with a preset list_filter? Put another way, where are the best usability customization points so the user sees a specific list filter when entering that modeladmin, and when being redirected after various actions, but

Re: Default values/prepopulate fields in ModelAdmin add view

2008-10-24 Thread Delta20
In case anyone else is trying to figure out how to do this, the solution I came up with was to put a dictionary of the values into the request and pass it to the ModelAdmin add_view function def some_view(request, ... ): ... values = { 'title': t, 'author': a }

Default values/prepopulate fields in ModelAdmin add view

2008-10-23 Thread Delta20
;: a } 4: admin = new ArticleAdmin() 5. ... 6: return admin.add_view(request) Notes: Line 4 - ArticleAdmin is a subclass of django.contrib.admin.ModelAdmin Line 6 - This method in ModelAdmin displays the standard admin change_form Is there a way to use the "values" dicti

Re: How to display image from ImageField in ModelAdmin?

2008-10-16 Thread krylatij
Code above was a bit incorrect. Here better solution: ## widget declaration from django.utils.safestring import mark_safe from django.forms.widgets import FileInput class AdminImageFieldWithThumbWidget(FileInput): def __init__(self, thumb_width=50, thumb_height=50): self.width = thum

Re: How to display image from ImageField in ModelAdmin?

2008-10-16 Thread volksman
Beauty in motion! Works like a charm...Thanks! --~--~-~--~~~---~--~~ 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,

Re: How to display image from ImageField in ModelAdmin?

2008-10-01 Thread krylatij
I have written some sample. it works for me, hope it will be usefull: from django.contrib.admin.widgets import AdminFileWidget from django.utils.safestring import mark_safe class AdminImageFieldWithThumbWidget(AdminFileWidget): def render(self, name, value, attrs=None): thumb_html =

Re: How to display image from ImageField in ModelAdmin?

2008-09-29 Thread krylatij
I think you need to write custom widget for ImageField --~--~-~--~~~---~--~~ 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 th

How to display image from ImageField in ModelAdmin?

2008-09-29 Thread Dave
Hi, I've been able to somewhat customize the admin page for a record by using fieldsets and list_display. Here's the thing though. I have an ImageField which I can show in list_display (I copied/modified a thumb function) but I can't figure out how to show the image in the fieldset. I know des

Re: new ModelAdmin set up

2008-09-08 Thread KillaBee
On Sep 8, 2:57 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Sep 8, 8:14 pm, KillaBee <[EMAIL PROTECTED]> > wrote: > > > > > I am editing my Admin.py to use the new ModelAdmin.  All my change has > > no effect.  I wanted it to come up with all my ap

Re: new ModelAdmin set up

2008-09-08 Thread Daniel Roseman
On Sep 8, 8:14 pm, KillaBee <[EMAIL PROTECTED]> wrote: > I am editing my Admin.py to use the new ModelAdmin.  All my change has > no effect.  I wanted it to come up with all my app automaticlly. > > I have this in my urls.py: > from django.contrib import admin &g

Re: new ModelAdmin set up

2008-09-08 Thread KillaBee
It's in there the whole thing looks like this: from django.conf.urls.defaults import * from django.contrib import admin #from intraweb.apps.timesheets.admin import basic_site, advanced_site admin.autodiscover() info_dict = { 'app_label': 'timesheets', 'module_name': 'entrys', 'date_field':

Re: new ModelAdmin set up

2008-09-08 Thread Martin Zimmerman
You need to add: admin.autodiscover() in your urls.py Regards, Martin On Sep 8, 9:14 pm, KillaBee <[EMAIL PROTECTED]> wrote: > I am editing my Admin.py to use the new ModelAdmin.  All my change has > no effect.  I wanted it to come up with all my app automaticlly. > >

new ModelAdmin set up

2008-09-08 Thread KillaBee
I am editing my Admin.py to use the new ModelAdmin. All my change has no effect. I wanted it to come up with all my app automaticlly. I have this in my urls.py: from django.contrib import admin . . . (r'^admin/(.*)', admin.site.root), == and m

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread fabio natali
Ivan Sagalaev wrote: > fabio natali wrote: > > For the sake of clarity, my django project is named arteak, the models > > we are using belong to an app called "management". > > Ah! Then there should of course be get_model('management', > kwargs.pop('model')). I thought 'arteak' was the name of t

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread Ivan Sagalaev
fabio natali wrote: > For the sake of clarity, my django project is named arteak, the models > we are using belong to an app called "management". Ah! Then there should of course be get_model('management', kwargs.pop('model')). I thought 'arteak' was the name of the app. This is why it returns N

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread fabio natali
Dear Ivan, it sounds like we are closer to the solution, still not got it though. Ivan Sagalaev wrote: [...] > > http://dpaste.com/72639/ > > Oy! I've found it :-). It has nothing to do with model_view decorator or > anything that we're talking here about. It's in urls.py, on line 30: > >

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread Ivan Sagalaev
fabio natali wrote: > That's right! So here comes my current urls.py: > > http://dpaste.com/72638/ > > then the traceback I get at http://localhost:8000/: > > http://dpaste.com/72639/ Oy! I've found it :-). It has nothing to do with model_view decorator or anything that we're talking here abo

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread fabio natali
Hi Ivan! Ivan Sagalaev wrote: [...] > fabio natali wrote: > > I added the line > > > > import arteak.management.models > > It's not the same thing :-). This line won't load the name "models" into > your local environment. If you want import from some path this should be: > > from a

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread Ivan Sagalaev
fabio natali wrote: >> import models > > I added the line > > import arteak.management.models It's not the same thing :-). This line won't load the name "models" into your local environment. If you want import from some path this should be: from arteak.management import models

Re: Generic Views and ModelAdmin: too much code?

2008-08-20 Thread fabio natali
Ivan Sagalaev wrote: [...] > fabio natali wrote: > > KeyError at /manufacturer > > u'manufacturer' > > when accessing http://localhost:8000/manufacturer > > KeyError says that it can't find a key 'manufacturer' in dict > model_classes. This leads me to think that model_classes is empty. It > ca

Re: Generic Views and ModelAdmin: too much code?

2008-08-19 Thread Ivan Sagalaev
fabio natali wrote: > This is the urls.py I created: http://dpaste.com/72138/ > It doesn't work though: I get a > KeyError at /manufacturer > u'manufacturer' > when accessing http://localhost:8000/manufacturer > (manufacturer being one of my model) KeyError says that it can't find a key 'manufact

Re: Generic Views and ModelAdmin: too much code?

2008-08-18 Thread fabio natali
Dear Ivan, your help is priceless, thanks! Ivan Sagalaev wrote: [...] > In models.py you can get rid of repeating "Manufacturer" two extra times > by doing: > > class Manufacturer(models.Model): > name = models.CharField(max_length=30) > address = models.CharField(max_len

Get ModelAdmin for specific Model

2008-07-21 Thread Alaa Salman
Hi all, Is there another way to get the ModelAdmin registered for a specific Model than to access the _registry of the AdminSite instance. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

<    1   2   3