Re: FileField in custom field

2019-11-05 Thread Simonas Pilkauskas
>> <https://github.com/Simonas0/django_playground/blob/master/files_in_custom_fields/models.py>, >> >> but apparently FileField in custom field doesn't work out of box (when >> trying to save, I get the error "can't adapt type >> 'TemporaryUploadedFile'"). Fi

Re: FileField in custom field

2019-11-05 Thread Integr@te System
d more check in this content. On Tue, Nov 5, 2019, 20:01 Simonas Pilkauskas < simonas.pilkaus...@hotmail.com> wrote: > Hello, > I want to setup a Model like this > <https://github.com/Simonas0/django_playground/blob/master/files_in_custom_fields/models.py>, > but apparently FileFi

FileField in custom field

2019-11-05 Thread Simonas Pilkauskas
Hello, I want to setup a Model like this <https://github.com/Simonas0/django_playground/blob/master/files_in_custom_fields/models.py>, but apparently FileField in custom field doesn't work out of box (when trying to save, I get the error "can't adapt type 'TemporaryUploadedFile'&qu

Custom field on admin.py - FieldDoesNotExist when using RelatedFieldWidgetWrapper

2019-05-08 Thread Naran Khetani
he actual model does not have those fields above, I have a feeling its looking up the actual model which is why its not finding the field. In essence what im trying to do is add a custom field that does not exist in the model which works fine, however i need to be able to add the plus button nex

create custom field in crm

2019-03-31 Thread dvij parekh
Any one who had made crm in django and know how to make custom field using django forms i have made custom fields using php and html code but now i want tot do it using django forms please let me know how to do it or if you know any resources -- You received this message because you

How to make custom field (defined as function) in StackedInline hidden?

2018-09-09 Thread Mirek Zvolsky
Django 2.1. I have this code: class AnswerInline(admin.StackedInline): model = Answer form = AnswerForm fields = ("question_answer_type", "answer_plain") readonly_fields = ("question_answer_type",) def question_answer_type(self, row): return row.question.answer_type This

Re: Custom field implementing Boolean Field is having response value as None instead of False

2017-06-19 Thread Priyanka Thakur
Hi Melvyn, Finally i had breakthrough and saw the root cause. The issue is that i haven't defined any default value for this Custom field in the model class. As per Django 1.10 documentation, the default value of Boolean Field is None if "default" value is not defined. Hence &q

Re: Custom field implementing Boolean Field is having response value as None instead of False

2017-06-19 Thread Melvyn Sopacua
On Monday 19 June 2017 04:00:42 Priyanka Thakur wrote: > On Monday, 19 June 2017 16:05:06 UTC+5:30, m712 - Developer wrote: > > Melvyn was not saying whether you were checking for None. If `value` > > is i.e. "some string" your to_python method will return `None`. You > > should do something like

Re: Custom field implementing Boolean Field is having response value as None instead of False

2017-06-19 Thread Priyanka Thakur
Oh, ok got the point !! Thanks !! Regards, Priyanka On Monday, 19 June 2017 16:05:06 UTC+5:30, m712 - Developer wrote: > > Melvyn was not saying whether you were checking for None. If `value` is > i.e. "some string" your to_python method will return `None`. You should do > something like

Re: Custom field implementing Boolean Field is having response value as None instead of False

2017-06-19 Thread m712 - Developer
Melvyn was not saying whether you were checking for None. If `value` is i.e. "some string" your to_python method will return `None`. You should do something like this: ```     if value in ('t', ...): return True     elif value in ('f', ...): return False     else: return bool(value) # You can

Re: Custom field implementing Boolean Field is having response value as None instead of False

2017-06-19 Thread Priyanka Thakur
Hi Melvyn, I am checking for None in the last if condition in to_python method : --copy-- > if value in ('f', 'False', 'false', '0', '\x00', *None*): return > False --copy-- Thanks for checking and replying !! Regards, Priyanka On Friday, 16 June 2017 20:03:22 UTC+5:30, Priyanka Thakur

Re: Custom field implementing Boolean Field is having response value as None instead of False

2017-06-16 Thread Melvyn Sopacua
On Friday 16 June 2017 07:33:22 Priyanka Thakur wrote: > Hi, > > I am doing migration from Django 1.7 to 1.10 version and has a custom > django field. > > Below is the custom class for the field: > > > > from django.db import models > > > > class

Custom field implementing Boolean Field is having response value as None instead of False

2017-06-16 Thread Priyanka Thakur
Hi, I am doing migration from Django 1.7 to 1.10 version and has a custom django field. Below is the custom class for the field: from django.db import models class HibernateBooleanField(models.BooleanField): def from_db_value(self, value, expression, connection, context):

Re: Django makemigrations cannot detect change when changing custom field overriding charfield.

2017-03-14 Thread Tim Graham
2017년 3월 13일 월요일 오후 10시 43분 53초 UTC+9, Tim Graham 님의 말: >> >> It looks like you need to add a CategoryField.deconstruct() method. >> >> >> https://docs.djangoproject.com/en/stable/howto/custom-model-fields/#custom-field-deconstruct-method >> >> O

Re: Django makemigrations cannot detect change when changing custom field overriding charfield.

2017-03-14 Thread 김지환
, Tim Graham 님의 말: > > It looks like you need to add a CategoryField.deconstruct() method. > > > https://docs.djangoproject.com/en/stable/howto/custom-model-fields/#custom-field-deconstruct-method > > On Monday, March 13, 2017 at 8:05:02 AM UTC-4, 김지환 wrote: >> >

Re: Django makemigrations cannot detect change when changing custom field overriding charfield.

2017-03-13 Thread Tim Graham
It looks like you need to add a CategoryField.deconstruct() method. https://docs.djangoproject.com/en/stable/howto/custom-model-fields/#custom-field-deconstruct-method On Monday, March 13, 2017 at 8:05:02 AM UTC-4, 김지환 wrote: > > # category.py > > > from django.db.models.fields i

Django makemigrations cannot detect change when changing custom field overriding charfield.

2017-03-13 Thread 김지환
.__init__(*args, **kwargs) # in my models.py class Car(models.Model): category = CategoryField() When I use custom field overriding django CharField, field changes that `max_length`, `choices` not detected by django makemigrations command. Add field migration works fine, and verbose_

Custom Field Default Value Serialization

2017-03-02 Thread qilin qi
Hi All, Apologize if this question has been asked before. This is my first question into this mailing list. I am creating a custom field(MyCustomField) with a custom value class(MyValue). I do have a deconstruct() method for my *field* class. And I would like to have a default value

How to set a custom field in a Django session model?

2017-01-30 Thread Utku Gültopu
I have extended the session in Django per [this][1]. In short, I have added a field named `account_id` to hold the user id of the user which the session belongs to. Everything works fine, except the custom field `account_id` I have added is not being set on login. To do so: from

Custom field reference flowchart

2016-01-12 Thread martin f krafft
Dear Django people, I'm working on something I called "IndirectGenericForeignKey",¹ and following suggestionsi I received on django-developers, I've made a bit of progress on my implementation, using a custom (pseudo-)field.² My code works, but I can't exactly say I understand all of it, which

Custom Field

2015-07-30 Thread Aurélio Moreira
I wanted your help to make a custom Field Type'm studying it at the time and I'm not getting. I'll put it to you here the code I've done so far. I hope your help. http://pastebin.com/81Lq86Xn Field http://pastebin.com/CvATavnd Widget http://pastebin.com/2tNcKtgfForm -- You received

Custom field definition for an iterable Python object

2015-04-07 Thread David Pick
I'm trying to write a custom field definition for a Python object that happens to be iterable. Most of the time it works, but sometimes I get an error generated in 'django/db/models/sql/where.py' in '_prepare_data' where the code tries to generate all the values in the iterable object because

Django - User custom field

2014-05-21 Thread Nikko Reyes
as a criteria / filter that will be used in page views. --- - http://stackoverflow.com/questions/23791526/django-user-custom-field -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving e

South migration when custom field definitions change

2013-10-28 Thread graeme
I have an app that uses some custom model fields. These are subclasses of standard fields. I have tried to include as many defaults as possible in custom field to stick to DRY. I have written South introspection rules for these that work fine when I change a model What happens when I change

Re: Displaying a custom field (PickledObjectField) in the admin

2013-09-10 Thread Paul
If you just want to see (read) the contents you could do this: class Example(models.Model): value = PickledObjectField() def value_unpacked(self): return u'{value}'.format(value=self.value) filter_link.allow_tags = True class ExampleAdmin(admin.ModelAdmin): list_display = ('id',

RE: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread lacrymol...@gmail.com
: Alphydan Enviados: 24/10/2012 19:58:29 Asunto: Re: Displaying a custom field (PickledObjectField) in the admin Hi Tomas & John, Thank you for your reply. Basically I'm trying to save curves which I chose to format as: [[0,0],[1,0],[2,1],[3,1], ... ,[40,0]] To see what I tried before (mo

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Alphydan
Hi Tomas & John, Thank you for your reply. Basically I'm trying to save curves which I chose to format as: [[0,0],[1,0],[2,1],[3,1], ... ,[40,0]] To see what I tried before (models, etc) you can see the stackoverflow

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Tomas Neme
Just by the way, I'm looking at django-picklefield code and README https://github.com/gintas/django-picklefield and it says NOTHING about a widget, or an admin representation, so.. maybe it's not DESIGNED to be shown on the admin? it'd make sense, too, since it's.. well, it can be ANYTHING On

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Tomas Neme
maybe restate the problem, give some more code, show your models, and your admin files, and someone may be able to help a little -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread John DeRosa
Nope, I didn't find a solution. I moved on to another issue and never got back to this. We just learned to work around this, I'm semi-ashamed to say. John On Oct 23, 2012, at 2:29 PM, Alphydan wrote: > I have the same problem (on ubuntu, python 2.7, django 1.4, >

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-23 Thread Alphydan
I have the same problem (on ubuntu, python 2.7, django 1.4, django-picklefield 0.2.1) ... does anybody have any insight? John, did you find a solution? Thank you. On Thursday, 8 April 2010 19:30:20 UTC+1, John DeRosa wrote: > > Hello Djangonauts, > > I'm doing something wrong, but I just can't

Re: custom field for callable python object like class or function

2012-08-23 Thread Michael Palumbo
Maybe using a Model like Kurtis mentioned will be better (and easier) than making a custom field... ? Le jeudi 23 août 2012 18:49:55 UTC+2, Michael Palumbo a écrit : > > I did not know the pickle module. This is interesting. Thanks. > However, after playing with it, I am not sur

Re: custom field for callable python object like class or function

2012-08-23 Thread Michael Palumbo
I did not know the pickle module. This is interesting. Thanks. However, after playing with it, I am not sure it fits totally my need because I'd like humans to be able to write a string like "modulea.moduleb.MyClass" in the admin or so. So I kept trying making a custom field (instead

Re: custom field for callable python object like class or function

2012-08-22 Thread Melvyn Sopacua
On 23-8-2012 0:37, Michael Palumbo wrote: > ok thanks, so you'd rather do it with a Model than a custom field. > I actually started to make a custom field but I had a few issues while > displaying it in the admin so that's why I asked the question then. You can pickle an object

Re: custom field for callable python object like class or function

2012-08-22 Thread Michael Palumbo
ok thanks, so you'd rather do it with a Model than a custom field. I actually started to make a custom field but I had a few issues while displaying it in the admin so that's why I asked the question then. Le jeudi 23 août 2012 00:16:48 UTC+2, Kurtis a écrit : > > Whoops, > > fo

Re: custom field for callable python object like class or function

2012-08-22 Thread Kurtis Mullins
property(get_reference, set_reference) > > Anyways, just a guess at one of many ways to possibly accomplish this task. > > > On Wed, Aug 22, 2012 at 5:58 PM, Michael Palumbo < > michael.palumb...@gmail.com> wrote: > >> Hi, >> >> Do you know a cu

Re: custom field for callable python object like class or function

2012-08-22 Thread Kurtis Mullins
< michael.palumb...@gmail.com> wrote: > Hi, > > Do you know a custom field for a callable python object like a Class or a > function ? > > It could store it as a string in the DB: "module1.module2.class" or > "module1.module2.function" > With tha

custom field for callable python object like class or function

2012-08-22 Thread Michael Palumbo
Hi, Do you know a custom field for a callable python object like a Class or a function ? It could store it as a string in the DB: "module1.module2.class" or "module1.module2.function" With that string, it could load it as a real python object when you get it from the D

Re: Custom field names in ModelForm

2012-05-10 Thread Bhashkar Sharma
Thanks for the reply Rajneesh, but I'm looking for a more scalable option. (Ideally I would like to write a wrapper of some kind which does the task regardless of which Model is it) My use case is that I'm using django-piston for building a REST API, which I tweaked to give me what I wanted

Re: Custom field names in ModelForm

2012-05-10 Thread Rajeesh Nair
> Is there a way to customize the field name (not just label) while creating > a ModelForm? > > Override the change_form template for the concerned model and put the label for the field in whatever way you like. Check out the django-templates documentation to know how to do this. -- You

Custom field names in ModelForm

2012-05-10 Thread Bhashkar Sharma
Is there a way to customize the field name (not just label) while creating a ModelForm? Eg. for the model: class Book(models.Model): title = models.CharField(max_length=256, db_index=True) author = models.CharField(max_length=512, db_index=True) published =

Re: access model/instance from custom field/widget

2011-10-04 Thread Aljosa Mohorovic
the is the only way i was able to access data in field/widget, any comments? class MyForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) self.fields['my_field'].instance_data = {'instance': self.instance}

access model/instance from custom field/widget

2011-10-04 Thread Aljoša Mohorović
if i have a modelform with custom field and widget how can i access current model/instance (or None) in field/widget? is it possible? Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: Is there a way to provide a delete-hook on a custom field?

2011-09-14 Thread Иван Иванов
Tue, 13 Sep 2011 10:40:38 -0600 Jeff Heard <jefferson.r.he...@gmail.com> написа: > I have a custom field class that very nicely references a document in > MongoDB, but I would like to have the document deleted if the record > is deleted. That is, I have a MongoDBField that stor

Re: Is there a way to provide a delete-hook on a custom field?

2011-09-13 Thread Shawn Milochik
You can use the post_delete signal in Django's signals. Then, assuming your MongoDB collection name is derived from your model in a consistent manner then you're all set. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Is there a way to provide a delete-hook on a custom field?

2011-09-13 Thread Jeff Heard
Thanks. That works! -- Jeff On Tue, Sep 13, 2011 at 11:13 AM, Shawn Milochik wrote: > You can use the post_delete signal in Django's signals. Then, assuming your > MongoDB collection name is derived from your model in a consistent manner > then you're all set. > > -- > You

Is there a way to provide a delete-hook on a custom field?

2011-09-13 Thread Jeff Heard
I have a custom field class that very nicely references a document in MongoDB, but I would like to have the document deleted if the record is deleted. That is, I have a MongoDBField that stores an object ID in a structured database using the regular Django ORM. The field back-references

Re: ModelAdmin, custom field: default value?

2011-06-28 Thread momo2k
Thanks, working :) def __init__(self, *args, **kwargs): super(MealModelForm, self).__init__(*args, **kwargs) try: instance = kwargs['instance'] self.fields['price'].initial = instance.price() except (KeyError, AttributeError): pass

Re: ModelAdmin, custom field: default value?

2011-06-28 Thread Marc Aymerich
On Tue, Jun 28, 2011 at 10:27 AM, Marc Aymerich wrote: > On Mon, Jun 27, 2011 at 11:03 PM, momo2k wrote: >> Hello, >> >> Is there a way to set dynamic default values for custom fields in the >> admin? >> >> Description of the problem: >> >> #

Re: ModelAdmin, custom field: default value?

2011-06-28 Thread Marc Aymerich
On Mon, Jun 27, 2011 at 11:03 PM, momo2k wrote: > Hello, > > Is there a way to set dynamic default values for custom fields in the > admin? > > Description of the problem: > > # models.py > # there are two models > class Meal(models.Model): >    name = ... > >    def

ModelAdmin, custom field: default value?

2011-06-27 Thread momo2k
Hello, Is there a way to set dynamic default values for custom fields in the admin? Description of the problem: # models.py # there are two models class Meal(models.Model): name = ... def check_new_price(self, price): # checks if the price is new and creates a new price if

Re: Seeking Django Counsel when adding a new model using South and a custom field for my ProtectedFileField subclass

2011-03-27 Thread Matteius
Ah most excellent, I certainly was missing something. Well this documentation was OK, but the having the schema migration auto- generate is priceless. I must have left my regex thinking mind elsewhere this morning ... blaming Nascar. Thanks for taking the time this solved my issue and the new

Re: Seeking Django Counsel when adding a new model using South and a custom field for my ProtectedFileField subclass

2011-03-27 Thread Ian Clelland
On Sun, Mar 27, 2011 at 1:47 PM, Matteius wrote: > add_introspection_rules([], ["^student_portal\.fields > \.ProtectedFileField"]) ... >  ! Cannot freeze field 'student_portal.assignment.provided_files' >  ! (this field has class >

Seeking Django Counsel when adding a new model using South and a custom field for my ProtectedFileField subclass

2011-03-27 Thread Matteius
I've read the documentation at South and I would really like to take this opportunity to say this project would be way better with improved documentation or maybe I'm just missing something. I recently added a new model to my project which is using South, which means syndcb no longer simply adds

Re: Django custom field or widget?

2011-02-16 Thread Shawn Milochik
Sure. In your ModelForm instance's __init__, set that field's ".choices" value. -- 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

Django custom field or widget?

2011-02-16 Thread ju
own field, widget, or both? And how? P.S. Also here http://stackoverflow.com/questions/5014687/django-custom-field-or-widget -- 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@google

Re: Can I add custom field to ModelForm?

2011-01-08 Thread Brian Neal
On Jan 7, 8:55 am, robos85 wrote: > Is it possible to add field (I want it to be visible in generated form and > after post) to form which is not included in Model? I need it to make a > check after form.is_valid(), but this field won't go to DB. > > If yes - how can I do that?

Re: Can I add custom field to ModelForm?

2011-01-07 Thread satyandra babu
Hi, i think form choice will work in this case. http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ class AuthorForm(forms.Form): name = forms.CharField(max_length=100) title = forms.CharField(max_length=3, widget=forms.Select(choices=TITLE_CHOICES))

Can I add custom field to ModelForm?

2011-01-07 Thread robos85
Is it possible to add field (I want it to be visible in generated form and after post) to form which is not included in Model? I need it to make a check after form.is_valid(), but this field won't go to DB. If yes - how can I do that? -- You received this message because you are subscribed to

Displaying a custom field (PickledObjectField) in the admin

2010-04-08 Thread John DeRosa
Hello Djangonauts, I'm doing something wrong, but I just can't see it! My problem is that a custom model field isn't being displayed in the Admin interface. I'm running OS X 10.6.3, Python 2.6, and Django 1.1.1. I installed django-picklefield 0.1.5 from PyPi, and I'm trying to use it in a

Custom field state

2010-03-24 Thread IsakovAN
Hello I have made a custom db.field - WeekdaysField wich allow me to split week days into four groups. Also I create forms.field and widget to display it as seven SELECTs. All works fine, but when I have tried to use it with inlinadmin... When editing object Foo wich have TablularInline with

Re: Can't override the default form field for my custom Field type. Help?

2010-02-12 Thread Karen Tracey
On Sat, Feb 13, 2010 at 2:00 AM, Kevin Audleman <kevin.audle...@gmail.com>wrote: > Django 1.2 > > I'm attempting to write my first custom Field Type. Eventually it will > do something more complicated, but for now I am simply sub-classing > the CharField. The first thin

Can't override the default form field for my custom Field type. Help?

2010-02-12 Thread Kevin Audleman
Django 1.2 I'm attempting to write my first custom Field Type. Eventually it will do something more complicated, but for now I am simply sub-classing the CharField. The first thing I'm doing is trying to change the default form field to be a MultipleChoiceField. I followed the directions here

setting 'choices' on a custom field

2009-10-23 Thread fink
problem: setting a form field's 'choices' in the __init__ of a field class does not affect the choices displayed in the resulting form. i suspect the problem lies somewhere in the custom field's handling of passed in values, but my form-fu is not strong enough to figure it out. for example,

Re: Custom field types and newforms admin

2009-08-23 Thread Hanpan
Hi, thanks for the reply. ImageWithThumbsField is custom field which extends ImageField. It creates a thumbnail. I am using it in my model definition, nothing to do with a form. syncdb is ignoring this field when it creates the table completely. On 23 Aug, 18:39, Daniel Roseman <

Re: Custom field types and newforms admin

2009-08-23 Thread Hanpan
Hi, thanks for the reply. ImageWithThumbsField is custom field which extends ImageField. It creates a thumbnail. I am using it in my model definition, nothing to do with a form. syncdb is ignoring this field when it creates the table completely. On 23 Aug, 18:39, Daniel Roseman <

Re: Custom field types and newforms admin

2009-08-23 Thread Daniel Roseman
On Aug 23, 3:44 pm, Hanpan <scenesh...@googlemail.com> wrote: > Hi, > > I have created a custom field type, which I am using like so: > > image_thumb = ImageWithThumbsField(_('preview image'), > upload_to='uploads/projects') > > But for some reason, when I run syn

Custom field types and newforms admin

2009-08-23 Thread Hanpan
Hi, I have created a custom field type, which I am using like so: image_thumb = ImageWithThumbsField(_('preview image'), upload_to='uploads/projects') But for some reason, when I run syncdb this custom field is being completely ignored. I tried using the 'widget' argument, but that caused

Re: How to implement a custom field (or relation) which supports List of Strings

2009-07-18 Thread Dudley Fox
On Fri, Jul 17, 2009 at 3:45 PM, Sam Tregar wrote: > On Fri, Jul 17, 2009 at 3:23 PM, Dudley Fox wrote: >> >> Should I have posted this to the developer's list? I ask because I >> have received no responses yet. Not even a "...you shouldn't do that." >> :)

Re: How to implement a custom field (or relation) which supports List of Strings

2009-07-17 Thread Sam Tregar
On Fri, Jul 17, 2009 at 3:23 PM, Dudley Fox wrote: > > Should I have posted this to the developer's list? I ask because I > have received no responses yet. Not even a "...you shouldn't do that." > :) I can help you with that - you shouldn't do that. Instead you should

Re: How to implement a custom field (or relation) which supports List of Strings

2009-07-17 Thread Dudley Fox
quot;, "Jamail"] >... >p = Person.objects.get(name="John") >friends = p.friends ># and now friends is a list. > lvd_parent - The name of our parent class > lvd_model_name - The name of our new model

How to implement a custom field (or relation) which supports List of Strings

2009-07-15 Thread Dudley Fox
a list. lvd_parent - The name of our parent class lvd_model_name - The name of our new model lvd_value_type - The value type of the value in our new model This has to be the name of one of the valid django model field typ

Re: Adding a custom field to an admin model (table)

2009-07-11 Thread Tavish
ntry, editable=False) > >      #have a field where they can edit their change. >      current_log_entry = models.CharField(blablabla) > > On Jul 11, 4:44 am, "Haestan" <haes...@hotmail.com> wrote: > > > > I would like to add a custom field to an existing

Re: Adding a custom field to an admin model (table)

2009-07-11 Thread Tavish
they can edit their change. current_log_entry = models.CharField(blablabla) On Jul 11, 4:44 am, "Haestan" <haes...@hotmail.com> wrote: > > I would like to add a custom field to an existing admin model, namely > > LogEntry. The goal is to add a comment field, where cu

Re: Adding a custom field to an admin model (table)

2009-07-11 Thread Haestan
> I would like to add a custom field to an existing admin model, namely > LogEntry. The goal is to add a comment field, where custom change > comments can be added in the admin whenever a model is saved. > > Is it even possible to add such a field without changing the existing &

Adding a custom field to an admin model (table)

2009-07-10 Thread haestan none
Hi, I would like to add a custom field to an existing admin model, namely LogEntry. The goal is to add a comment field, where custom change comments can be added in the admin whenever a model is saved. Is it even possible to add such a field without changing the existing admin codebase

custom field in ModelAdmin

2009-06-22 Thread Andrés Otárola
Hi I need to do a slight hack in my model's form, its a model with a one to many relationship with the same. this is roughly my model (recursive one to many relationship): class Product(models.Model) bar_code = models.CharField(max_length=100,unique=True) compose =

custom Field for Model choice

2009-04-15 Thread Christopher Dodd
pretty well, but I'm not so keen on the code and would appreciate advice for cleaning it up and making it easier to use. I especially don't like having to call fix_initial_form_value() from the form. Are there better ways to do this? Here is the custom Field code, followed by an example using

Re: LaTeX custom Field, png url

2009-02-16 Thread Alex Gaynor
On Mon, Feb 16, 2009 at 12:05 PM, alain31 wrote: > > What I understood reading custom-model-fields.html is that Field class > only handle one column in database > (db_type method returns a database type...). I first thought to > inherit from TextField and build the name of the

Re: LaTeX custom Field, png url

2009-02-16 Thread alain31
What I understood reading custom-model-fields.html is that Field class only handle one column in database (db_type method returns a database type...). I first thought to inherit from TextField and build the name of the png file using a hash from the LaTeX string (so no need to store it in the

Re: LaTeX custom Field, png url

2009-02-16 Thread Alex Gaynor
On Mon, Feb 16, 2009 at 10:40 AM, alain31 <asoy...@free.fr> wrote: > > Hello, > I plan to use django for some projects with heavy use of math formulas > and I would like to create a reusable custom field to store LaTeX > strings and to get a png image on disk after compilati

LaTeX custom Field, png url

2009-02-16 Thread alain31
Hello, I plan to use django for some projects with heavy use of math formulas and I would like to create a reusable custom field to store LaTeX strings and to get a png image on disk after compilation. The usage would go like this : model: formula = LatexField() template to get the png

Several 'virtual' fields controlled by an unique custom field ?

2009-02-09 Thread Alexandre Vaissiere
by convert function would lead to a 500 response. So I pondered myself, and came back with a custom field and its associated form field: class CustomTextField(TextField): def __init__(self, *args, **kwargs): super(CustomTextField, self).__init__(*args, **kwargs) def formfield(self

custom field value representation

2009-01-03 Thread Matias Surdi
Hi, Suppose I have the following model: class Document(BaseModel): name = models.CharField(max_length=150,blank=True) description = models.TextField(blank=True) file = Models.FileField(upload_to="data/documentation/document/%Y/%m/%d",blank=True) And suppose I've a model I

Re: A custom field that populates other models

2008-12-11 Thread bruno desthuilliers
On 11 déc, 16:30, pielgrzym wrote: > Thanks for your suggestions! Now I made the tagging work without any > inside changes due to proper url escaping :) Fine !-) > Unfortunately tagging > crashes multilingual app on postgresql database (I posted an issue >

Re: A custom field that populates other models

2008-12-11 Thread pielgrzym
Thanks for your suggestions! Now I made the tagging work without any inside changes due to proper url escaping :) Unfortunately tagging crashes multilingual app on postgresql database (I posted an issue here: http://code.google.com/p/django-multilingual/issues/detail?id=79 ). I think I should

Re: A custom field that populates other models

2008-12-11 Thread bruno desthuilliers
On 11 déc, 01:11, pielgrzym <[EMAIL PROTECTED]> wrote: (snip) > The problem with saving is that when I try to save a post instance I > recieve: > > AttributeError: 'TagField' object has no attribute '_meta' > (link to full error report:http://wklej.org/hash/098a9cbd7a/) > > I'm not sure if

Re: A custom field that populates other models

2008-12-10 Thread pielgrzym
Thanks for numerous corrections and help :) "doesn't work" was stupid indeed ;) sorry :) The problem with saving is that when I try to save a post instance I recieve: AttributeError: 'TagField' object has no attribute '_meta' (link to full error report: http://wklej.org/hash/098a9cbd7a/ ) I'm

A custom field that populates other models

2008-12-10 Thread pielgrzym
Hi there, I followed some examples in the documentation regarding contenttype and I wanted to write my own simple, generig tagging app. I know there is tagging application but it's troublesome when you try to pass tag names in GET (language specific chars). Here is my code - it doesn't work -

New custom field and widget for admin

2008-11-19 Thread Andy McKay
I'm stuck on creating a custom widget for the admin interface and wondering if anyone can help on where to look. I've got a field which is essential a ForeignKey pointing to a State model. In the admin interface I would like to show the current state (done) and a list of the possible

Re: custom field problem w/Django v1.0

2008-10-07 Thread Siemster
ing > django.core.validators, but since that doesn't exist in v1.0 I'm > trying to replace the functionality with a custom field. > > The code that I'm using is as follows: > # > # app_utils/__init.py__ > from django.db.models imp

custom field problem w/Django v1.0

2008-10-03 Thread Siemster
Greetings, I'm in the process of porting an application from Django v0.96 (using Python 2.3) to v1.0 (using Python 2.4). I had been using django.core.validators, but since that doesn't exist in v1.0 I'm trying to replace the functionality with a custom field. The code that I'm using

Re: custom field: clean-method not called ...

2008-08-27 Thread patrickk
patrickk wrote: > > I´m just trying to write a custom field for the django filebrowser (a > > filebrowsefield). the __init__ method of the form-field is called, but > > the clean method is not ... instead the clean method of > > forms.CharField is called, which is strange,

Re: custom field: clean-method not called ...

2008-08-27 Thread Malcolm Tredinnick
On Wed, 2008-08-27 at 01:42 -0700, patrickk wrote: > I´m just trying to write a custom field for the django filebrowser (a > filebrowsefield). the __init__ method of the form-field is called, but > the clean method is not ... instead the clean method of > forms.CharField is c

custom field: clean-method not called ...

2008-08-27 Thread patrickk
I´m just trying to write a custom field for the django filebrowser (a filebrowsefield). the __init__ method of the form-field is called, but the clean method is not ... instead the clean method of forms.CharField is called, which is strange, because a) I´ve made a model field (FileBrowseField

Re: [Fwd: Custom field in JSON serializer]

2008-06-28 Thread Malcolm Tredinnick
On Sun, 2008-06-29 at 06:45 +0530, M.Ganesh wrote: [...] > Can I use the existing serializer with a list? If yes may be I can > construct the list by hand and then serialize. The list will have less > than 10 entries only Django's serializer is for serializing models (or querysets). However,

Re: [Fwd: Custom field in JSON serializer]

2008-06-28 Thread M.Ganesh
Russell Keith-Magee wrote: > On Sat, Jun 28, 2008 at 6:03 PM, M.Ganesh <[EMAIL PROTECTED]> wrote: > >> people who asked after me got their answers, sometimes >> within 15 minutes. I've not got any answers >> > > Don't worry - we still love you. :-) > > >> How do I extend this to

Re: [Fwd: Custom field in JSON serializer]

2008-06-28 Thread Russell Keith-Magee
On Sat, Jun 28, 2008 at 6:03 PM, M.Ganesh <[EMAIL PROTECTED]> wrote: > > people who asked after me got their answers, sometimes > within 15 minutes. I've not got any answers Don't worry - we still love you. :-) > How do I extend this to do the following: > > data =

Re: [Fwd: Custom field in JSON serializer]

2008-06-28 Thread Will Larson
Ganesh, You'll need to create your own serializer. You can do this by subclassing django.core.serializers.base (or perhaps you might subclass the json one, there are a number of ways to skin the cat here), and then registering it with django.core.serializers.register_serializer, which is

[Fwd: Custom field in JSON serializer]

2008-06-28 Thread M.Ganesh
people who asked after me got their answers, sometimes within 15 minutes. I've not got any answers Should I reword my query? Regards Ganesh Original Message Hi All, I picked up this sample code from django documentation: from django.core import serializers data =

  1   2   >