Solved [Was: How can I use a custom widget in the Admin for a custom user]

2020-01-07 Thread Mike Dewhirst
On 6/01/2020 7:26 pm, Mike Dewhirst wrote: Sorry for being boring  ... I cannot persuade the UserAdmin to use a custom widget instead of the one it usually uses. If you can point out where I'm going wrong I will be indebted to you.  I have tried two ways of using a custom widget ... 1

How can I use a custom widget in the Admin for a custom user

2020-01-06 Thread Mike Dewhirst
Sorry for being boring  ... I cannot persuade the UserAdmin to use a custom widget instead of the one it usually uses. If you can point out where I'm going wrong I will be indebted to you.  I have tried two ways of using a custom widget ... 1. https://docs.djangoproject.com/en/2.2/ref

Withdrawn [Was: Is this a bug OR How can I use a custom widget in the Admin for a custom user]

2020-01-05 Thread Mike Dewhirst
On 6/01/2020 4:31 pm, Mike Dewhirst wrote: It appears that formfield_for_manytomany() triggers an error if it is used in UserAdmin. Thanks for any support in deciding if this is a bug - or perhaps all my own work. I needed to finish formfield_for_manytomany() with a return

Is this a bug OR How can I use a custom widget in the Admin for a custom user

2020-01-05 Thread Mike Dewhirst
It appears that formfield_for_manytomany() triggers an error if it is used in UserAdmin. Thanks for any support in deciding if this is a bug - or perhaps all my own work. Cheers Mike TL;DR Here is all the admin code which works without error if formfield_for_manytomany()is commented out

Create custom widget in django-jet

2018-04-13 Thread j . romeroc97
Hey everybody, I'm here for some help, I'm using django-jet right now and trying to create a new widget with a view that I created before, somebody has knowledge about how to do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To

ManytoMany Relation and Custom widget in Django

2017-11-17 Thread Paul
I have two models Category and Products. - a Product can have multiple Categories - a Category can have multiple Products. - Categories have a circular Foreign key, to itself. - not all Categories have the same depth level Example: Category A - Category A_1 - category A_2

ManytoMany Relation and Custom widget in Django

2017-11-13 Thread Paul
I have two models Categories and Products. A Product can have multiple Categories, a Category can have multiple Products. The Categories have a circular Foreign key, to itself. class Product: categories = models.ManyToManyField(Category) name =

How to create a custom widget using django for use on external sites

2017-10-02 Thread Frankline
I hava a new site that I am working on. The site will have prior agreement with eCommerce sites to include add-ons on their website. Consider the following example: My website, ABC.com is targeting ecommerce sites. For every ecommerce site that sells product X, I want them to include an add-on

Re: Static CSS file for custom widget

2016-12-30 Thread ludovic coues
Have you looked at the media class ? https://docs.djangoproject.com/en/1.10/topics/forms/media/ 2016-12-29 13:20 GMT+01:00 Antonis Christofides <anto...@djangodeployment.com>: > Hello everyone, > > can a custom widget specify a static CSS file? I think the

Static CSS file for custom widget

2016-12-29 Thread Antonis Christofides
Hello everyone, can a custom widget specify a static CSS file? I think the

Re: Custom Widget for CharField Multiple

2016-12-28 Thread roboslone
Hi! If I understand this correctly, subclassing `forms.widgets.Input` was a wrong idea. As you can see in Input's source (https://docs.djangoproject.com/en/1.10/_modules/django/forms/widgets/#Input ), it always

Custom Widget for CharField Multiple

2016-12-28 Thread Farhan Khan
Hi, I am trying to create a `CharFieldMultiple`, equivalent to the MultipleHiddenInput or SelectMultiple. The goal is to have multiple CharField returned as a list, but have not been able to recreate it. My code thus far is: class CharFieldMultiple(forms.widgets.Input): def render(self,

configuring a custom widget subclass based on user entered data

2016-07-19 Thread David Durkee
Hi, I am trying to create a custom widget that is a subclass of MultiWidget that creates a variable number of widgets based on previous user input. Which means I can’t fully configure the widget in the form class. A simplified description of what I am trying to accomplish is to have one form

Re: Custom model field and custom widget

2015-02-19 Thread Collin Anderson
Hi, Sorry for the late reply. Check out editable=False if you haven't. Collin On Friday, January 30, 2015 at 9:03:41 AM UTC-5, Thomas Weholt wrote: > > Hi, > > I need to create a custom django model field, a varchar(10) field which > has a calculated value set on save on the model using it and

Custom model field and custom widget

2015-01-30 Thread Thomas Weholt
Hi, I need to create a custom django model field, a varchar(10) field which has a calculated value set on save on the model using it and then never changed. This should happen automatically. This field should appear as hidden or read-only in forms and it would be nice to handle the render

Django Custom Widget throwing error

2013-12-21 Thread Mrinmoy Das
I have this form and custom widget class BidDateWidget(widgets.DateInput): """ Renders a Twitter Bootstrap Date Input. """ class Media: css = ("{{ STATIC_URL }}stylesheet/datetimepicker.css") js = ("{{ STATIC_URL }}js/

Admin custom widget and add new button

2012-08-08 Thread Leonardo Giordani
Hi all, I'm trying to enhance a form in the admin site for a given model (Django 1.3). The relevant part of the model is the following class Project(models.Model): [...] icon = models.ForeignKey(Icon, null=True) [...] and the admin is a simple call to admin.site.register(). This way I get

Re: How to create a custom widget?

2012-04-23 Thread Corbin Tarrant
Here is my original post that describes what I'm trying to do: https://groups.google.com/forum/?fromgroups#!searchin/django-users/corbin/django-users/hJzxsm63WC8/AOD_NAoAhaYJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this

How to create a custom widget?

2012-04-23 Thread Corbin Tarrant
I'm new to django and trying to create my first application and am having some difficulty. I created another post last week but haven't gotten any response. I did get some response in the IRC channel though and it was mentioned that I could use a custom widget to get the job done. I have been

foreign key form custom widget

2011-06-13 Thread bitgandtter
hi, i want to define a widget to my form exactly to a field that is a foreign key to another model. like the doc say i use the widgets statements in the meta class, but the field of foreign key dont change this widget to that i define. is this at even possible? What should i do? -- You received

Re: How can I manually use RelatedFieldWidgetWrapper around a custom widget?

2010-03-10 Thread justind
) self.fields['files'].queryset = File.objects.filter(resource=self.instance.pk) self.fields['files'].empty_label = None On Mar 9, 4:25 pm, justind <justin.don...@gmail.com> wrote: > Hello, > > I've created a custom widget to replace the many to many widget found > in the admin

How can I manually use RelatedFieldWidgetWrapper around a custom widget?

2010-03-09 Thread justind
Hello, I've created a custom widget to replace the many to many widget found in the admin. Its working well, but I lose the "add" button when I use it. I see that the functionality is added by wrapping the widget in the RelatedFieldWidgetWrapper, but I can't figure out how to

Re: Custom widget for a modelform field

2010-03-08 Thread Daniel Roseman
On Mar 9, 7:20 am, Odd <o...@her-e-me.com> wrote: > It works fine if I'm not using a modelform, i.e. > > class MyForm(forms.Form): >    data=forms.CharField(widget=MySelect()) > > Can one not use a custom widget in a modelform? > > Thanks. The 'widgets' argument is

Re: Custom widget for a modelform field

2010-03-08 Thread andreas schmid
: > It works fine if I'm not using a modelform, i.e. > > class MyForm(forms.Form): >data=forms.CharField(widget=MySelect()) > > Can one not use a custom widget in a modelform? > > Thanks. > > -- You received this message because you are subscribed to the Google Groups

Re: Custom widget for a modelform field

2010-03-08 Thread Odd
It works fine if I'm not using a modelform, i.e. class MyForm(forms.Form): data=forms.CharField(widget=MySelect()) Can one not use a custom widget in a modelform? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" grou

Custom widget for a modelform field

2010-03-08 Thread Odd
I'm trying to write a custom select widget for a modelform field, but the render method of the widget doesn't seem to get called. This is how I define the modelform: class MyForm(ModelForm): class Meta: model=MyModel fields=('data',) widgets = { 'data':

Creating a custom widget

2009-08-28 Thread nbv4
, but what I'm trying to do now is have it so when I create a FlightForm formset, my route field is rendered as a textbox with the __unicode__ representation, instead of just the primary key as it is now. How can I do this? I understand I need to be making a custom widget not a custom field to do

Re: Custom widget for images is deleting them

2009-02-11 Thread phoebebright
.py > > A    9765/setup.cfg > >  U   9765 > > Checked out revision 9824. > > > And dates are Feb 2 > > > Any suggestions? > > > On Feb 11, 11:32 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > > > On Wed, Feb 11, 2009 at 6:30 PM, phoebebrig

Re: Custom widget for images is deleting them

2009-02-11 Thread Alex Gaynor
And dates are Feb 2 > > > Any suggestions? > > On Feb 11, 11:32 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > > On Wed, Feb 11, 2009 at 6:30 PM, phoebebright <phoebebright...@gmail.com > >wrote: > > > > > > > > > > > &g

Re: Custom widget for images is deleting them

2009-02-11 Thread phoebebright
out revision 9824. And dates are Feb 2 Any suggestions? On Feb 11, 11:32 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Wed, Feb 11, 2009 at 6:30 PM, phoebebright > <phoebebright...@gmail.com>wrote: > > > > > > > I thought I had a custom widget

Re: Custom widget for images is deleting them

2009-02-11 Thread Alex Gaynor
On Wed, Feb 11, 2009 at 6:30 PM, phoebebright <phoebebright...@gmail.com>wrote: > > I thought I had a custom widget which would allow images to be deleted > working and was dead chuffed (http://groups.google.com/group/django- > users/browse_thread/thread/ebf646208fa8880f/c22f8

Custom widget for images is deleting them

2009-02-11 Thread phoebebright
I thought I had a custom widget which would allow images to be deleted working and was dead chuffed (http://groups.google.com/group/django- users/browse_thread/thread/ebf646208fa8880f/c22f87e85b5d78ef? lnk=gst=admin+image#c22f87e85b5d78ef) but unfortunately it doesn't work. I have spent

Re: inlineformset_factory with a custom widget for a field

2008-12-18 Thread Cortland Klein
Yep that works, adding that and the following to forms.py: > from django.forms import fields > from django.db import models On Thu, Dec 18, 2008 at 11:53 AM, panta wrote: > > noticing you have provided also models.py, here is a more complete > answer: > > def

Re: inlineformset_factory with a custom widget for a field

2008-12-18 Thread Daniel Roseman
On Dec 18, 7:18 pm, Cortland Klein wrote: > I'm using inlineformset_factory in one of my views, which is working   > great, except now I'd like to change the widget for one of the fields   > (in case anyone's curious, an AdminFileWidget). For clarification this   > is my own

Re: inlineformset_factory with a custom widget for a field

2008-12-18 Thread panta
noticing you have provided also models.py, here is a more complete answer: def my_formfield_cb(field): if isinstance(field, models.FileField) and field.name == 'file': return fields.FileField(widget = AdminFileWidget(attrs={'url': "/my/url/"})) return field.formfield()

Re: inlineformset_factory with a custom widget for a field

2008-12-18 Thread panta
I've never used inlineformset_factory(), but I guess you can use the formfield_callback parameter. For example: def my_formfield_cb(field): if condition_on_field(field): return SuitableFormField(widget = MyCustomWidget()) return field.formfield() FileFormSet =

inlineformset_factory with a custom widget for a field

2008-12-18 Thread Cortland Klein
I'm using inlineformset_factory in one of my views, which is working great, except now I'd like to change the widget for one of the fields (in case anyone's curious, an AdminFileWidget). For clarification this is my own view and has nothing to do with contrib/admin. I see that

Re: Custom Widget for admin application

2008-12-05 Thread Ricardo Bánffy
But what if I have a ForeignKey or a ManyToManyField in my model? On Fri, Dec 5, 2008 at 12:58 PM, Michel Thadeu Sabchuk <[EMAIL PROTECTED]> wrote: > Pass a grouped list to choices: > > ['group1', [(1, 'item 1'), (2, 'item 2'), ...], ...] --~--~-~--~~~---~--~~

Re: Custom Widget for admin application

2008-12-05 Thread Michel Thadeu Sabchuk
Hi Ricardo, > 1) Is there a sane way to make a custom widget that extends Select and > that has its options grouped by in tags according to some > criteria? Pass a grouped list to choices: ['group1', [(1, 'item 1'), (2, 'item 2'), ...], ...] > 2) How one does make the built-

Custom Widget for admin application

2008-12-05 Thread Ricardo Bánffy
Hi folks. I am looking into Django and the admin framework and I have a couple newbie-ish questions: 1) Is there a sane way to make a custom widget that extends Select and that has its options grouped by in tags according to some criteria? 2) How one does make the built-in admin app to use

Re: access current model id, for custom widget

2008-11-25 Thread yves_s
I want that only dogs (no other animals from other groups) are listed in the foreignkey drop down box for the representative_animal (which would be all animals without modification) when I'm editing the AnimalGroup dogs. I finally hacked something together with the threadlocals middleware, which

Re: access current model id, for custom widget

2008-11-24 Thread Donn
Sorry for being dense, but I don't really follow what you need. Look in the docs for backward relationships between foreign keys. That may help you. Something like: group = Animal.objects.get(animal_group__id=XX) But I don't know where you decide what XX is. \d

Re: access current model id, for custom widget

2008-11-24 Thread yves_s
thanks for the replies donn and malcolm, here in more detail what I want to archive perhaps I'm on the totally wrong track... How do I pass the PASSANYTHINGHERE=whatever parameters to the widget (see sample code)? (the super part is clear, thanks) How to pass the "value" id on ModelForm level to

Re: access current model id, for custom widget

2008-11-24 Thread Malcolm Tredinnick
On Mon, 2008-11-24 at 13:07 +0200, Donn wrote: > Further info, > Looks like from within a widget there's no easy way to find the Form. I'd a > thunk there'd be a Parent attribute, but there ain't. The way Django does this is fairly normal design practice. Normal OO implementation practice is

Re: access current model id, for custom widget

2008-11-24 Thread Donn
Further info, Looks like from within a widget there's no easy way to find the Form. I'd a thunk there'd be a Parent attribute, but there ain't. So: If you are doing something like this: class SomeWidget( forms.TextInput ): def __init__(self,attrs=None, PASSANYTHINGHERE=whatever ):

Re: access current model id, for custom widget

2008-11-24 Thread Donn
On Monday, 24 November 2008 12:21:55 yves_s wrote: > does anybody have some hints? IIRC - You can do: form.instance (inside your widget, I think...) This assumes you made a form with something like: f = MyForm(instance = someInstance) On the command-line, try using: python manage.py shell Then

Re: access current model id, for custom widget

2008-11-24 Thread yves_s
does anybody have some hints? On 21 Nov., 00:24, yves_s <[EMAIL PROTECTED]> wrote: > hi everybody > I'm making a custom form widget in the newforms admin and I want to > have access to the id of the current model instance (for already > existing data). > Can I get the id from the request object?

access current model id, for custom widget

2008-11-20 Thread yves_s
hi everybody I'm making a custom form widget in the newforms admin and I want to have access to the id of the current model instance (for already existing data). Can I get the id from the request object? Or any other solution? I'm really going mad with this problem.. yves

Re: custom widget necessary?

2008-08-25 Thread peter_g
Thank you, Norman! > > Do you have links to examples? > > http://www.djangosnippets.org/snippets/937/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: custom widget necessary?

2008-08-25 Thread Norman Harman
peter_g wrote: > Hi! > > I have datetime fields like "createdate" or "modified" in some of my > models. > Do I need to create custom widgets if i want their time and date to > be displayed in the admin area (change-form) and not the default > editable representation (text fields, with "now" etc.

custom widget necessary?

2008-08-25 Thread peter_g
Hi! I have datetime fields like "createdate" or "modified" in some of my models. Do I need to create custom widgets if i want their time and date to be displayed in the admin area (change-form) and not the default editable representation (text fields, with "now" etc. shortcuts)? Like, e.g.

Re: Custom Widget with jQuery?

2008-05-07 Thread Richard Dahl
t need to add the class phone to the > > appropriate widgets attributes. > > That might be the way to go. I think I might just be trying to > over-complicate things. I was trying to figure out how to have the custom > widget take care of the needed javascript, such as pulling in the

Re: Custom Widget with jQuery?

2008-05-07 Thread Kevin Monceaux
way to go. I think I might just be trying to over-complicate things. I was trying to figure out how to have the custom widget take care of the needed javascript, such as pulling in the needed jQuery files and adding the $(".phone").mask("(999)999-"); to the page, "b

Re: Custom Widget with jQuery?

2008-05-07 Thread Richard Dahl
9").focus(); > > }); > > > to the head, and in the body: > > > > which works nicely. I've searched the newforms documentation a bit but > I'm not sure how to best create a custom widget that would achieve the > above. Specifically, how would one handle in

Custom Widget with jQuery?

2008-05-07 Thread Kevin Monceaux
}); to the head, and in the body: which works nicely. I've searched the newforms documentation a bit but I'm not sure how to best create a custom widget that would achieve the above. Specifically, how would one handle including the needed bits of javascript in such a way that if multip

Re: Popup 'add another' and custom widget in newforms-admin

2007-11-22 Thread Julien
"I have created a custom widget using the branch newforms-admin to > represent a ManyToMany relation with checkboxes." > > On Nov 22, 10:49 pm, Julien <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > I have created a custom widget using the branch newform

Re: Popup 'add another' and custom widget in newforms-admin

2007-11-22 Thread Julien
Ooops, just realised I didn't finished writing the first sentence of my previous post. So here it is: "I have created a custom widget using the branch newforms-admin to represent a ManyToMany relation with checkboxes." On Nov 22, 10:49 pm, Julien <[EMAIL PROTECTED]> wrote: >

Popup 'add another' and custom widget in newforms-admin

2007-11-22 Thread Julien
Hi all, I have created a custom widget using the branch newforms-admin to represent (see code below): To test it, create a couple of countries, then a few cities attached to those countries, and then create a new Person. In the class PersonOptions, the line "formfield.widget.r

Re: Admin custom widget

2007-05-22 Thread Jens Werner
I found the solution. It is very simple. I need only a directory named 'widget' in my project-template-directory. Thats all! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Admin custom widget

2007-05-15 Thread Jens Werner
Hi everybody, I'm creating a new widget/template for my admin interface (image_with_thumbnail.html for nesh.thumbnail.field.ImageWithThumbnailField). For the moment it works fine, if I put the image_with_thumbnail.html in django/contrib/admin/templates/widget, but I don't want patch the

Re: Custom Widget

2007-05-08 Thread dballanc
from util import flatatt My guess is that you really mean: from django.newforms.util import flatatt It works for the django widgets.py file because they are in the same folder. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Custom Widget

2007-05-08 Thread Thomas Rabaix
Hello I am trying to create a new Input Widget called 'MapInput'. However the line : "from util import flatatt" from my widgets.py seems to break something. My code comes from the newforms/widgets.py file. If I comment the lines relatives to the flatatt, my widget works fine. Do you ave any

Ticket-worthy? 0.96 newforms custom widget TypeError exception suppressed by render_to_response

2007-04-09 Thread JeffH
Is this worthy of a ticket? Observed behavior: Django (v0.96) render_to_response renders a template but renders nothing for {{ form.as_table }} tag when (unbeknownst to the poor programmer) a TypeError exception is raised during the rendering of a custom newforms widget. My preferred behavior:

Re: How would I add a custom widget in the admin for a ManyToMany relationship?

2006-12-08 Thread Adrian Holovaty
On 12/8/06, naitsirhc <[EMAIL PROTECTED]> wrote: > I'm kind of surprised that I didn't find > mention of the 'raw_id_admin' in my previous searches - is it > relatively new? Nope, it's not new -- raw_id_admin has been around since before Django was open-sourced. Adrian -- Adrian Holovaty

Re: How would I add a custom widget in the admin for a ManyToMany relationship?

2006-12-08 Thread naitsirhc
Thank you very much for your help. I should be able to modify this to suit my needs perfectly. I'm kind of surprised that I didn't find mention of the 'raw_id_admin' in my previous searches - is it relatively new? I see that it has been involved in some active development in the Django source

Re: How would I add a custom widget in the admin for a ManyToMany relationship?

2006-12-08 Thread Paul Childs
There is a lot of information in this group about solving this problem. Look at raw_id_admin http://groups.google.com/group/django-users/search?group=django-users=raw_id_admin_g=1=Search+this+group --~--~-~--~~~---~--~~ You received this message because you

How would I add a custom widget in the admin for a ManyToMany relationship?

2006-12-07 Thread naitsirhc
Hello, I am currently working on a Django app and am quite pleased with the framework overall. The problem I am currently having is that the default Django admin widget for a ManyToMany relationship is a multiple select box. This is causing a big problem for me since I have thousands of