Custom admin field widgets in the newforms-admin branch

2007-06-26 Thread leif
One of the stated goals of the newforms-admin branch ( http://code.djangoproject.com/wiki/NewformsAdminBranch ) is to allow developers to specify custom widgets for particular fields in a model. I have not been able to find documentation regarding this new feature. Has it been implemented yet? Th

Re: Custom admin field widgets in the newforms-admin branch

2007-06-26 Thread leif
By the way, I did find the hook in django/branches/newforms-admin/ django/contrib/admin/options.py for specifying the form field for a given database field. But that's different than allowing a developer to specify the widget for a given field in the model itself. --~--~-~--~~--

Zip code lookup field

2007-06-26 Thread leif
Hi there. I'm new to Django and Python, so I appreciate any help you guys can provide. I am working on an app that allows a user to create extended profiles with text and photos. In addition, each profile is associated with a single ZIP code via a ForeignKey. As it stands now, the admin add-prof

Re: Zip code lookup field

2007-06-26 Thread leif
Very good point, Tim. I'll consider that issue as I move forward with my application. My main problem, though, is figuring out how to create a text input lookup field for the ZIP code foreign key. Do I need to code a new widget? A new form field class? A function to hook into newforms' validation

Re: Zip code lookup field

2007-06-26 Thread leif
> Django's existing admin uses oldforms. The newforms-admin branch is > working to rewrite admin to be more flexible and use newforms. If you > need it on trunk now, you'll need to use oldforms. Thanks for the input, Jeremy. I've actually decided to use newforms- admin since I won't be going to

Re: Zip code lookup field

2007-06-27 Thread leif
Great advice -- thanks! I'll work on it today and let you know how it comes together. --~--~-~--~~~---~--~~ 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@googlegro

Re: Custom admin field widgets in the newforms-admin branch

2007-06-27 Thread leif
Does anyone have information on this topic? I have a feeling I'm not the only one who's wondering this. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

loading script deployment

2018-02-10 Thread Leif
/activate appenv (appenv)$python manage.py load_data data_file.csv I would like to deploy this script to my client. I don't want to send the entire code of web application. How do I do it? Thank you in advance for your help. Best, Leif -- You received this message because you are subscribed t

Re: loading script deployment

2018-02-10 Thread Leif
Hi Dylan, Thank you for the great input. Hopefully django REST interface will be able to handle the post for large amount of data (~500k rows) without problem. Best, Leif On Saturday, February 10, 2018 at 10:14:29 AM UTC-5, Leif wrote: > > Dear Django, > > Sorry if this quest

Re: loading script deployment

2018-02-11 Thread Leif
Thank you, Jani, I will try. Best, Leif On Saturday, February 10, 2018 at 10:14:29 AM UTC-5, Leif wrote: > > Dear Django, > > Sorry if this question has been answered. I have a Django based web > application and I just developed a loading script to upload data to > database

django restframework relation

2018-03-14 Thread Leif
ude XyzSerializer(serializers.ModelSerializer) so all three objects will be included in json output. Thank you very much in advance, Leif -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: django restframework relation

2018-03-14 Thread Leif
;? How to do reverse relation in this case? Best, Leif On Wednesday, March 14, 2018 at 11:14:49 AM UTC-4, Leif wrote: > > Dear Django, > > I have a question about django rest framework relations. I am looking at > the example in > http://www.tomchristie.com/rest-framewor

restore migration files

2018-06-06 Thread Leif
Dear Django Experts: Somehow I deleted the files under migrations directory. Now I am no longer able to migrate new changes. I got 'No change detected' message when I apply python manage.py migrate. Anway I can restore files under migrations directory? Best, Leif -- You rec

Re: restore migration files

2018-06-06 Thread Leif
there is a suggestion here but not clear: https://stackoverflow.com/questions/34919650/deleted-migration-files-how-to-makemigrations-without-losing-data On Wednesday, June 6, 2018 at 8:54:48 AM UTC-4, Leif wrote: > > Dear Django Experts: > > Somehow I deleted the files under migratio

Re: restore migration files

2018-06-06 Thread Leif
Hi Kirby, Thank you very much. That is very helpful. It is working now. Now the migrations directory is tracked in code repository to prevent from happening again. Best, Leif On Wednesday, June 6, 2018 at 10:23:01 AM UTC-4, C. Kirby wrote: > > If you don't need the history

Re: restore migration files

2018-06-06 Thread Leif
replace the deleted migrations. > > *Connected by Motorola* > > > Leif > wrote: > > Dear Django Experts: > > Somehow I deleted the files under migrations directory. Now I am no longer > able to migrate new changes. I got 'No change detected' message when I

Re: Zip code lookup field

2007-06-27 Thread leif strickland
OK, I've been tinkering with this all day, and I'm still having one big problem As Jeremy suggested, I created custom ZipCodeField and MyAdmin classes. In addition, I created a custom ZipcodeLookupInput widget. I've tested this in the shell and on the test server, and the clean and render functi

Re: Zip code lookup field

2007-06-27 Thread leif strickland
OK, I've been tinkering with this all day, and I'm still having one big problem As Jeremy suggested, I created custom ZipCodeField and MyAdmin classes. In addition, I created a custom ZipcodeLookupInput widget. I've tested this in the shell and on the test server, and the clean and render functio

Re: Zip code lookup field

2007-06-27 Thread leif strickland
Yes, the ModelAdmin is registered with django.contrib.admin.site. And the change and add pages for the model are displaying correctly. It even provides the expected error message if I enter an invalid Zip code. But when I enter a correct Zip code and Save, it gives me an Integrity Error: ---

Re: Zip code lookup field

2007-06-27 Thread leif strickland
Yes, the ModelAdmin is registered with django.contrib.admin.site. And the change and add pages for the model are displaying correctly. It even provides the expected error message if I enter an invalid Zip code. But when I enter a correct Zip code and Save, it gives me an Integrity Error:

Re: Zip code lookup field

2007-06-27 Thread leif strickland
Here's a bit of the testing I have run in the shell... >>> from mysite2.profile.models import Profile >>> from django import newformms >>> from mysite2.admin import ProfileOptions >>> >>> # instantiate a Profile object >>> test_profile = Profile.objects.get(id=1) >>> >>> # instantiate the admino

Re: Zip code lookup field

2007-06-27 Thread leif strickland
Here's a bit of the testing I have run in the shell... >>> from mysite2.profile.models import Profile >>> from django import newforms >>> from mysite2.admin import ProfileOptions >>> # instantiate a Profile object >>> test_profile = Profile.objects.get(id=1) >>> # instantiate the adminoptions cla

Re: Zip code lookup field

2007-06-27 Thread leif strickland
I figured it out! The problem was that my custom zip code field's clean() function was returning the profile object's *id*, not the actual zip code instance. > zip_code_id = Postal_Code.objects.get(postal_code=value).id > return int(zip_code_id) As it turns out, the function should have retur

Re: Announcing the birth of Fluther.com

2007-06-27 Thread leif strickland
Looks great. Good work! For those of us still stuck in alpha, can you share a bit about your implementation? Are you using Apache? Squid? What's your approach to caching? Did you use Django's built-in User model for your registered site users? What DB did you opt for? Any information would be a

Re: Custom admin field widgets in the newforms-admin branch

2007-06-27 Thread leif strickland
After some digging around, it looks like the newforms-admin branch does not allow widget declarations within the model class itself. However, adding a custom widget is quite easy. In the branch, almost all of the admin app functionality has been moved out of the inner Admin class and into a separ