Hello All, On Django admin when I tried to update the existing data I’m getting an error,
AttributeError: 'str' object has no attribute '__iter__' models.py class SSPDrive(models.Model): drive_year = models.DateField(verbose_name='Drive year', null=True, blank=True, help_text="Enter drive year.") class Meta: verbose_name = "SSP Drive" verbose_name_plural = "SSP Drives" def __str__(self): return str('SSP'+str(self.drive_year.year)[-2:]+'T'+str(self.drive_year.year+1)[-2:]) class SSPDriveAdmin(admin.ModelAdmin): save_as = True class Meta: model = SSPDrive admin.site.register(SSPDrive, SSPDriveAdmin) Can someone help me out, why am I getting this error… > On 21-Jun-2017, at 6:37 PM, django-users@googlegroups.com wrote: > > django-users@googlegroups.com > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/django-users/topics> > Google Groups > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > > Today's topic summary <> > View all topics > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/django-users/topics> > import different entries using filter <x-msg://12/#group_thread_0> - 2 Updates > Non-primary auto-incrementing field with Postgres > <x-msg://12/#group_thread_1> - 2 Updates > User Based role in Django <x-msg://12/#group_thread_2> - 6 Updates > Django Import/Export ManyTo Many <x-msg://12/#group_thread_3> - 1 Update > url patterns question <x-msg://12/#group_thread_4> - 3 Updates > Django phone number validation <x-msg://12/#group_thread_5> - 2 Updates > If you have multiple custom users - what should you set AUTH_USER_MODEL to? > <x-msg://12/#group_thread_6> - 1 Update > [django] Excluir un ítem de un dropdown en el admin de django > <x-msg://12/#group_thread_7> - 1 Update > Django app to manage PHP-composer repositories <x-msg://12/#group_thread_8> - > 2 Updates > Django website <x-msg://12/#group_thread_9> - 2 Updates > [django-channels] Issues with model post_save and Group.Send() > <x-msg://12/#group_thread_10> - 1 Update > <>import different entries using filter > <http://groups.google.com/group/django-users/t/f65f28b427a47574?utm_source=digest&utm_medium=email> > > Melvyn Sopacua <m.r.sopa...@gmail.com>: Jun 20 10:37PM +0200 > > On Monday 19 June 2017 21:11:23 jon stan wrote: > > > service__icontains='fast food') > > > but i cant get it to work correctly. i get 'burger-place' for the > > name, prod, and service variables for ...more > > <http://groups.google.com/group/django-users/msg/57d4e03837e?utm_source=digest&utm_medium=email> > > > Derek <gamesb...@gmail.com>: Jun 21 03:12AM -0700 > > Your clue is in the word "variable" that you used. The "variables" for a > Django model are its fields; so what you are looking for is a value stored > in your model's field. > > e.g. > > service = ...more > <http://groups.google.com/group/django-users/msg/22aa669843366?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>Non-primary auto-incrementing field > with Postgres > <http://groups.google.com/group/django-users/t/ffc077e7afacbd48?utm_source=digest&utm_medium=email> > > Scot Hacker <scot.hac...@gmail.com>: Jun 20 10:40PM -0700 > > One strategy might be to: > > 1) Bring in the data under a different column name ('old_id' ?) > 2) In a single migration, drop the default ID column, rename old_id to id, > and give it primary_key=True ...more > <http://groups.google.com/group/django-users/msg/21bce2407a674?utm_source=digest&utm_medium=email> > > Melvyn Sopacua <m.r.sopa...@gmail.com>: Jun 21 11:43AM +0200 > > On Monday 19 June 2017 16:29:48 Thomas Hauk wrote: > > serial field, and then run a SQL command like "SELECT > > SETVAL('some_table_field_id_seq', 100000)". I think. :) > > > Does Django expose ...more > > <http://groups.google.com/group/django-users/msg/307549dba313?utm_source=digest&utm_medium=email> > > > Back to top <x-msg://12/#digest_top> <>User Based role in Django > <http://groups.google.com/group/django-users/t/d898ee185d7ee0f5?utm_source=digest&utm_medium=email> > > Mannu Gupta <abhimanyu98...@gmail.com>: Jun 21 12:45AM -0700 > > I want to make a role based user in Django like the following :- > > User with Subscription level 0 will have some feature and some basic fields > like first name , last name etc. > ...more > <http://groups.google.com/group/django-users/msg/222a23801ac61?utm_source=digest&utm_medium=email> > > Jani Tiainen <rede...@gmail.com>: Jun 21 11:11AM +0300 > > Hi, > > We have been using user groups for that. And then we check and filter out > based on given group(s). > > ...more > <http://groups.google.com/group/django-users/msg/2b5e90eea6ad?utm_source=digest&utm_medium=email> > > Mannu Gupta <abhimanyu98...@gmail.com>: Jun 21 01:44PM +0530 > > Hi , > Will I be able to trace if user upgrde the subscription level ? > > Manni > > ...more > <http://groups.google.com/group/django-users/msg/2b8716e3fa92?utm_source=digest&utm_medium=email> > > Jani Tiainen <rede...@gmail.com>: Jun 21 11:18AM +0300 > > Well its your code, so yes if you write code that does it. > > It doesn't happen magically for you. > > ...more > <http://groups.google.com/group/django-users/msg/2bbbb89f8254?utm_source=digest&utm_medium=email> > > Mannu Gupta <abhimanyu98...@gmail.com>: Jun 21 01:53PM +0530 > > I meant that using your method i.e by making different groups . > When he upgrade the group . > How about making another table having user, his subscription level and > changed_at field(which traces when ...more > <http://groups.google.com/group/django-users/msg/2c0601b32729?utm_source=digest&utm_medium=email> > > Jani Tiainen <rede...@gmail.com>: Jun 21 12:43PM +0300 > > Hi, > > User can't upgrade his group. It is your code that does it. And it is your > code responsibility to track changes etc. > > User just may have a button on ui that invokes your code (view) but rest > ...more > <http://groups.google.com/group/django-users/msg/3067e3fd5487?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>Django Import/Export ManyTo Many > <http://groups.google.com/group/django-users/t/53a77396faef6f09?utm_source=digest&utm_medium=email> > > dtdave <dturne...@googlemail.com>: Jun 21 02:39AM -0700 > > I have a model with a manytomany field as follows: > > contact = ChainedManyToManyField( > 'contacts.Contact', > chained_field="practice", > chained_model_field="practice", ...more > <http://groups.google.com/group/django-users/msg/228de8fadba7a?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>url patterns question > <http://groups.google.com/group/django-users/t/b588684e31a14a1b?utm_source=digest&utm_medium=email> > > Melvyn Sopacua <m.r.sopa...@gmail.com>: Jun 20 11:20PM +0200 > > On Monday 19 June 2017 16:43:12 James Schneider wrote: > > regex algorithm behavior is incorrect. In most cases, the matching > > algorithm will take the first and almost always shortest match (there > > ...more > > <http://groups.google.com/group/django-users/msg/7e29439b737?utm_source=digest&utm_medium=email> > > > James Schneider <jrschneide...@gmail.com>: Jun 20 06:08PM -0700 > > > > > The .* modifier means "match any character (.) zero or more times > > > > (*)". Since blank/ matches the .* zero times, it is a match for your > > > > expression. > > Yeah...you're right. ...more > <http://groups.google.com/group/django-users/msg/14453f56e9ba?utm_source=digest&utm_medium=email> > > Melvyn Sopacua <m.r.sopa...@gmail.com>: Jun 21 11:08AM +0200 > > On Tuesday 20 June 2017 18:08:02 James Schneider wrote: > > > that > > requests.GET.get('abc') will return '12/' per the last example from > > the OP. > > Yes, but for the first problem, r'^blank/.*$' ...more > <http://groups.google.com/group/django-users/msg/2e89aa5ea788?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>Django phone number validation > <http://groups.google.com/group/django-users/t/164609cf92fc1a24?utm_source=digest&utm_medium=email> > > Santosh Yelamarthi <santosh.yelamar...@gmail.com>: Jun 20 11:18PM -0700 > > Hi All, > > Can anyone please share how to validate phone number in django. > > Thanks in advance. > ...more > <http://groups.google.com/group/django-users/msg/21deaffb6273d?utm_source=digest&utm_medium=email> > > "Andréas Kühne" <andreas.ku...@hypercode.se>: Jun 21 09:03AM +0200 > > Hi, > > https://github.com/stefanfoulis/django-phonenumber-field > <https://github.com/stefanfoulis/django-phonenumber-field> > > You could probably use that library - it works against googles phonenumber > library, which is the library that is used on andoid ...more > <http://groups.google.com/group/django-users/msg/27a160d5a62c?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>If you have multiple custom users - > what should you set AUTH_USER_MODEL to? > <http://groups.google.com/group/django-users/t/52b50df4f58ac0cb?utm_source=digest&utm_medium=email> > > Mike Dewhirst <mi...@dewhirst.com.au>: Jun 21 09:50AM +1000 > > On 20/06/2017 1:13 PM, Mike Dewhirst wrote: > > the unwanted models, they never get created. > > > You need a bit of jiggery pokery in admin.py but it can be done. I'll > > try and get some time later ...more > > <http://groups.google.com/group/django-users/msg/100700fc308d?utm_source=digest&utm_medium=email> > > > Back to top <x-msg://12/#digest_top> <>[django] Excluir un ítem de un > dropdown en el admin de django > <http://groups.google.com/group/django-users/t/e27eb266f9159113?utm_source=digest&utm_medium=email> > > Melvyn Sopacua <m.r.sopa...@gmail.com>: Jun 20 10:31PM +0200 > > On Tuesday 20 June 2017 02:24:20 Rafael E. Ferrero wrote: > > > > The trouble it's because Firefighter class is a child of Person > class > > so the Firefighter item are in the two dropdowns and it ...more > > <http://groups.google.com/group/django-users/msg/5344a2b30d9?utm_source=digest&utm_medium=email> > > > Back to top <x-msg://12/#digest_top> <>Django app to manage PHP-composer > repositories > <http://groups.google.com/group/django-users/t/5988ff50bf7e7bf0?utm_source=digest&utm_medium=email> > > Philipp Zedler <phil...@neue-musik.com>: Jun 20 05:41PM +0200 > > Hi Django Users, > > I'd like to manage composer packages using a Django App. (Composer is > the git of PHP, roughly speaking.) > > Is there already some Django App that does this? > > Best wishes ...more > <http://groups.google.com/group/django-users/msg/450b0df804cfd?utm_source=digest&utm_medium=email> > > Melvyn Sopacua <m.r.sopa...@gmail.com>: Jun 20 10:16PM +0200 > > On Tuesday 20 June 2017 17:41:03 Philipp Zedler wrote: > > > I'd like to manage composer packages using a Django App. > (Composer is > > the git of PHP, roughly speaking.) > > I'm gonna say you meant ...more > <http://groups.google.com/group/django-users/msg/464b9e785cb?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>Django website > <http://groups.google.com/group/django-users/t/2f510ef0f61a80d4?utm_source=digest&utm_medium=email> > > MigDotCom <migueld...@gmail.com>: Jun 20 11:24AM -0700 > > I want to use python and django to make a news-feed for my website I have > searched about it but i still don't even have clue where to start: > 1. Do i make it as a new app in my django site? ...more > <http://groups.google.com/group/django-users/msg/45b815a24e129?utm_source=digest&utm_medium=email> > > yingi keme <yingik...@gmail.com>: Jun 20 09:03PM +0100 > > Is your project residing in django? Or you are using a different web > framework? > > Yingi Kem > > ...more > <http://groups.google.com/group/django-users/msg/45ec011d9bac7?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> <>[django-channels] Issues with model > post_save and Group.Send() > <http://groups.google.com/group/django-users/t/2dd5fe0735465b2?utm_source=digest&utm_medium=email> > > Andrew Godwin <and...@aeracode.org>: Jun 20 10:40AM -0700 > > Well, I need to know even a vague shape of what's happening to be able to > help - is it getting stuck in an infinite loop? Is it running out of > memory? Without this sort of information, I won't be ...more > <http://groups.google.com/group/django-users/msg/456edec97ba2a?utm_source=digest&utm_medium=email> > > Back to top <x-msg://12/#digest_top> > You received this digest because you're subscribed to updates for this group. > You can change your settings on the group membership page > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/django-users/join>. > To unsubscribe from this group and stop receiving emails from it send an > email to django-users+unsubscr...@googlegroups.com > <mailto:django-users+unsubscr...@googlegroups.com>. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2B0A5205-3DAC-486E-90CB-14017AE6CF8D%40gmail.com. For more options, visit https://groups.google.com/d/optout.