Hello, I want to fetch an image from web and upload to my project as records picture. My latest codes are below:
#model: class Node(models.Model): user = models.ForeignKey(User) url = models.URLField(null=False, unique=True) slug = models.SlugField(max_length=128, blank=True, null=False) title = models.CharField(max_length=128) description = models.TextField() picture = models.ImageField(upload_to='uploads/ pictures', blank=True) #form: class NodeForm(forms.ModelForm): url = forms.URLField(widget=forms.HiddenInput()) title = forms.CharField(max_length=128, widget=forms.TextInput(attrs={'class': 'title text'})) description = forms.CharField(widget=forms.Textarea(attrs={'class': 'description textarea', 'rows': 5})) picture = forms.ImageField(required=False, widget=forms.HiddenInput()) #template: <form method="post" action="." enctype="multipart/form-data"> <ul> {{ form.as_li}} </ul> <ul> <li><label> <input type="radio" name="picture" value="http://examle.com/image1.jpg " /><img src="http://examle.com/image1.jpg" /></label></li> <li><label> <input type="radio" name="picture" value="http://examle.com/image2.jpg " /><img src="http://examle.com/image1.jpg" /></label></li> </ul> </form> I call myself as a newbie coder, I couldn't handle this since morning and my brain stopped now. Any idea please. Thanks alot. Ozgur Gunes --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---