This mailing list is for the development of Django itself, not for support.
Use the django-users mailing list for that, or IRC #django on freenode, or
a site like Stack Overflow.

On 26 December 2017 at 00:01, Atef Ouerghi <[email protected]> wrote:

> I would like to retrieve the value of a field in ModelAdmin in order to
> use as a parameter for requets, but I can't get the value from the data
> base
> I get this <django.db.models.query_utils.DeferredAttribute object at
> 0x000001B24C6E5F60>
> Any help
>
> class AlienTaxonomy(models.Model):
>
>     class Meta:
>         db_table = 'taxonomy'
>         verbose_name = ('Alien Species Taxonomy')
>         verbose_name_plural = ('Aliens Species Taxonomy')
>         ordering = ['SpeciesName']
>
>     SpeciesName = models.CharField(max_length=100, verbose_name=u"Species 
> Name")
>     url=models.URLField(verbose_name=u"Link to WORMS")
>     Authority = models.CharField(max_length=100, verbose_name=u"Authority")
>     kingdom = models.CharField(max_length=100, verbose_name=u"Kingdom")
>     Phylum = models.CharField(max_length=100, verbose_name=u"Phylum")
>     Class = models.CharField(max_length=100, verbose_name=u"Class")
>     Order1 = models.CharField(max_length=100, verbose_name=u"Order")
>     Family = models.CharField(max_length=100, verbose_name=u"Family")
>     Genus = models.CharField(max_length=100, verbose_name=u"Genus")
>
>     def __str__(self):  # __unicode__ on Python 2
>             return self.SpeciesName
>
>
>
> def get_Aphia(ModelAdmin, request, queryset):
>
>     if request.method == 'POST':
>        species = SpeciesName
>
>
>
>     for Aliens in queryset:
>
>     req = requests.get('http://www.marinespecies.org/rest/AphiaIDByName/'+ 
> str(species) + '?marine_only=true')
>
>     body = json.loads(req.content)
>
>     queryset.update(url=body)
>
>     #Aliens.save()
>
> get_Aphia.short_description = 'Check by WoRMS'
>
>
>
> class TaxonomyAdmin(admin.ModelAdmin):
>     list_per_page = 30
>     list_filter = ('SpeciesName', 'Authority','url','kingdom', 'Phylum', 
> 'Class', 'Order1', 'Family','Genus')
>     list_display = ['SpeciesName', 'url','Authority','kingdom', 'Phylum', 
> 'Class', 'Order1', 'Family','Genus']
>     fields = ['SpeciesName']
>     actions = [get_Aphia, get_classification, get_synonyms]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/9a24caee-cdbe-456f-abc4-
> dfba8b6eaf1d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/9a24caee-cdbe-456f-abc4-dfba8b6eaf1d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM0o0ku7Kf6NoJOrDS7b993bN_QDEspEoL8cCgwp_yD9-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to