Hi, Rename your __unicode__ to __str__. Python 3 doesn't know what "__unicode__" is. :)
You say this works fine: >>> from ccdgen.models import DvBoolean,DvAny, Common, Project >>> pcts = DvBoolean.objects.all() >>> for p in pcts: ... print(p.prj_name.prj_name) But django is expecting this also to work: >>> pcts = DvBoolean.objects.all() >>> for p in pcts: ... print(p.prj_name) Collin On Sunday, 18 January 2015 12:31:06 UTC-5, Timothy W. Cook wrote: > > > On Sat, Jan 17, 2015 at 11:49 AM, Collin Anderson <cmawe...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> Did you also switch to Python 3? >> > > Yes. > > Well, I didn't switch. I have been using Python 3 for quite some time. > Even before it was officially supported. > > > >> It doesn't seem to be using your __unicode__ method at all. >> If you query one of these Projects in manage.py shell, do they show the >> project name? >> > > As I said before, my views that use AJAX to return data from queries > still work just as before. But yes, in the manage.py shell I can import > the models and print the names. > > >>> from ccdgen.models import DvBoolean,DvAny, Common, Project > >>> pcts = DvBoolean.objects.all() > >>> for p in pcts: > ... print(p.prj_name.prj_name) > > caBIG > caBIG > caBIG > caBIG > caBIG > caBIG > caBIG > > ... > > > > > >> Are you sure that the __unicode__ method is actually attached to your >> model? >> >> > I am not exactly sure what you mean by that question; attached? Here > is the code: > > class Project(models.Model): > """ > Every item created in CCDGEN must be assigned to a Project when > created. All items (except CCD) may be > reused in multiple CCDs. However, this does not change the original > Project. > The Allowed Groups field contains each of the User Groups allowed to > see each item with this Project name. > The User Group, Open, is assigned to every user. So if you assign the > Open group as one of the allowed groups, > all CCDGEN users will see this item. > """ > pgroup = models.ForeignKey(Group, verbose_name='Primary Group', > related_name='primarygroup', null=True) > prj_name = models.CharField(_("project name"), max_length=110, > unique=True, db_index=True, help_text=_('Enter the name of your project.')) > description = models.TextField(_("project description"), blank=True, > help_text=_('Enter a description or explaination of an acronym of the > project.')) > rm_version = models.ForeignKey(RMversion, verbose_name=_('rm > version'), related_name='%(class)s_related', help_text=_('Choose the > version of the MLHIM Reference Model you are using.')) > allowed_groups = models.ManyToManyField(Group, verbose_name=_('allowed > groups'), related_name='%(class)s_related', help_text=_('Choose the groups > that are allowed to work in this project.')) > > def __unicode__(self): > return self.prj_name > > > class Meta: > verbose_name = _("Project") > verbose_name_plural = _("Projects") > ordering = ['prj_name'] > > > > >> Also, FYI, to_field="prj_name" means you can't easily change the name of >> the project. >> >> > Yes, Once created the name cannot be changed, and once an item is > assigned to a project the attached items are immutable. > > Thanks, > Tim > > > > >> Collin >> >> On Friday, January 16, 2015 at 3:14:55 PM UTC-5, Timothy W. Cook wrote: >>> >>> I should also mention that I have some AJAX calls for the same >>> information and they still work fine. So I am quite certain it is in the >>> Admin templates or the Admin properties definitions. >>> >>> On Fri, Jan 16, 2015 at 5:56 PM, Timothy W. Cook <t...@mlhim.org> wrote: >>> >>>> Is this a bug or did I miss something in the release notes? >>>> >>>> Moving from 1.6.4 to 1.7.3 the listing in the Admin UI is not >>>> resolving a related field now. There are not any model changes involved. >>>> >>>> Attached are two screen shots named for the versions. >>>> >>>> I haven't changed the admin code either. For the screen shots the >>>> admin code is: >>>> >>>> class DvBooleanAdmin(admin.ModelAdmin): >>>> list_filter = ['prj_name__rm_version__version_id','prj_name',] >>>> search_fields = ['data_name','ct_id'] >>>> ordering = ['prj_name','data_name'] >>>> actions = [make_published, unpublish, copy_dt, republish] >>>> readonly_fields = ['published','schema_code','r_ >>>> code','xqr_code','xqw_code',] >>>> def get_form(self, request, obj=None, **kwargs): >>>> try: >>>> if obj.published: >>>> self.readonly_fields = ['prj_name','published','lang' >>>> ,'schema_code','data_name','valid_trues','valid_falses',' >>>> description','sem_attr','resource_uri','asserts','xqr_ >>>> code','xqw_code',] >>>> except (AttributeError, TypeError) as e: >>>> self.readonly_fields = ['published','schema_code','r_ >>>> code','xqr_code','xqw_code',] >>>> return super(DvBooleanAdmin, self).get_form(request, obj, >>>> **kwargs) >>>> >>>> fieldsets = ( >>>> (None, {'classes':('wide',), >>>> 'fields':('published','prj_ >>>> name','data_name','lang','valid_trues','valid_falses')}), >>>> ("Additional Information ", {'classes':('wide',), >>>> 'fields':('description','sem_ >>>> attr','resource_uri','asserts',)}), >>>> ("PCT Code (read-only)", {'classes':('collapse',), >>>> 'fields':('schema_code','r_ >>>> code','xqr_code','xqw_code',)}), >>>> >>>> ) >>>> list_display = ('data_name','prj_name','published',) >>>> admin.site.register(DvBoolean, DvBooleanAdmin) >>>> >>>> In the model for the displayed admin: >>>> prj_name = models.ForeignKey(Project, verbose_name=_("Project >>>> Name"), to_field="prj_name", help_text=_('Choose the name of your >>>> Project.')) >>>> >>>> and the related field in Project is: >>>> prj_name = models.CharField(_("project name"), max_length=110, >>>> unique=True, db_index=True, help_text=_('Enter the name of your project.')) >>>> >>>> ... >>>> >>>> def __unicode__(self): >>>> return self.prj_name >>>> >>>> >>>> >>>> Any ideas? >>>> >>>> Should I file a bug report? >>>> >>>> Thanks, >>>> Tim >>>> >>>> >>>> >>>> >>>> >>>> >>>> ============================================ >>>> Timothy Cook >>>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook >>>> MLHIM http://www.mlhim.org >>>> >>>> >>> >>> >>> -- >>> >>> ============================================ >>> Timothy Cook >>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook >>> MLHIM http://www.mlhim.org >>> >>> -- >> 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...@googlegroups.com <javascript:>. >> To post to this group, send email to django...@googlegroups.com >> <javascript:>. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/d9cf8bcf-5311-46bb-b902-83042d27a94d%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/d9cf8bcf-5311-46bb-b902-83042d27a94d%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > ============================================ > Timothy Cook > LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook > MLHIM http://www.mlhim.org > > -- 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 http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6ff80471-6a68-4c59-b777-fa4d901c406d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.