What’s the code for importing pymysql database in Django manage.py ?

> On Aug 15, 2018, at 6:28 PM, Shashank Parekh <[email protected]> 
> wrote:
> 
> Can you post  your apps.py file?
> 
> On Wednesday, August 15, 2018 at 6:22:34 PM UTC+5:30, Vikrant Gupta wrote:
> I'm trying to get a name from a column named Artist. But got an error in 
> using get().
>  The code is as follows...
> from django.db import models
> # Create your models here.
> 
> 
> class Artist(models.Model):
>     name=models.CharField('artist',max_length=50,primary_key=True)
>     year_formed=models.PositiveIntegerField()
> 
> class Album(models.Model):
>     name=models.CharField('album',max_length=50)
>     artist=models.ForeignKey(Artist,on_delete=models.PROTECT)
> 
> from polls.models import Artist
> 
> newartist=Artist(name='Vikrant',year_formed=1985)
> newartist.save()
> 
> artist=Artist.objects.all()
> for i in artist:
>     print(i.name <http://i.name/>)
>     print(i.year_formed)
> 
> ind=Artist.objects.get(id=1)
> print(ind.name <http://ind.name/>)
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/1863fb8d-01a2-49c7-b5dd-ac225958371b%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/1863fb8d-01a2-49c7-b5dd-ac225958371b%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/8D81E281-A2DC-4BE4-9426-1B26ECB78D07%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to