Re: media file upload

2019-09-18 Thread Luca Bertolotti
thanks

Il giorno mercoledì 18 settembre 2019 19:29:00 UTC+2, mohammed habib ha 
scritto:
>
> Make sure to add ‘enctype="multipart/form-data"’ to your form tag, so 
> that the file data is included in when the form is submitted
>
>
> https://stackoverflow.com/questions/4526273/what-does-enctype-multipart-form-data-mean
>
> Sent from my iPhone
>
> On 18 Sep 2019, at 17:38, Luca Bertolotti  > wrote:
>
> Hello i can't upload the file, i'm in a debug mode:
>
> the urls.is:
>
> from django.contrib import admin
> from django.urls import path, include
> from django.conf import settings
> from django.conf.urls.static import static
>
>
> urlpatterns = [
> path('', include('polls.urls')), 
> path('admin/', admin.site.urls),
> 
> 
> ]
> if settings.DEBUG is True:
> urlpatterns += static(settings.MEDIA_URL, 
> document_root=settings.MEDIA_ROOT)
>
> The model is:
>
> class Disegni(models.Model):
> iddisegni = models.AutoField(primary_key=True)
> descrizione = models.CharField(max_length=45, blank=True, null=True)
> revisione = models.CharField(max_length=45, blank=True, null=True)
> file = models.FileField(upload_to='disegni/', blank=True, null=True)
>
> class Meta:
> managed = False
> db_table = 'disegni'
>
> the forms is:
> class DisegniForm(forms.ModelForm):
> 
> class Meta:
> model = Disegni
> fields = ('iddisegni', 'descrizione', 'revisione', 'file')
> labels = {'descrizione':'Descrizione', 'revisione':'Revisione', 
> 'file':'File'}
>
>
> The settings.py is:
>
> STATIC_URL = '/static/'
> MEDIA_URL = '/media/'
> STATIC_ROOT = "E:/dngo/mysite/polls/static"
> MEDIA_ROOT = "E:/dngo/mysite/polls/media"
>
> the template is generated 
>
> The template is just : 
>
> {% load static %}
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
> Salva
>
>
>
> I never get errors but the file is not uploaded
> Where is my mistake?
>
> -- 
> 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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a8713cc3-2a4c-42ba-8c54-976e1a4b8090%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e0aa54ab-f8eb-4690-a656-c2aac39eec5a%40googlegroups.com.


Re: media file upload

2019-09-18 Thread Luca Bertolotti
Thanks

Luca

Il giorno mercoledì 18 settembre 2019 19:29:00 UTC+2, mohammed habib ha 
scritto:
>
> Make sure to add ‘enctype="multipart/form-data"’ to your form tag, so 
> that the file data is included in when the form is submitted
>
>
> https://stackoverflow.com/questions/4526273/what-does-enctype-multipart-form-data-mean
>
> Sent from my iPhone
>
> On 18 Sep 2019, at 17:38, Luca Bertolotti  > wrote:
>
> Hello i can't upload the file, i'm in a debug mode:
>
> the urls.is:
>
> from django.contrib import admin
> from django.urls import path, include
> from django.conf import settings
> from django.conf.urls.static import static
>
>
> urlpatterns = [
> path('', include('polls.urls')), 
> path('admin/', admin.site.urls),
> 
> 
> ]
> if settings.DEBUG is True:
> urlpatterns += static(settings.MEDIA_URL, 
> document_root=settings.MEDIA_ROOT)
>
> The model is:
>
> class Disegni(models.Model):
> iddisegni = models.AutoField(primary_key=True)
> descrizione = models.CharField(max_length=45, blank=True, null=True)
> revisione = models.CharField(max_length=45, blank=True, null=True)
> file = models.FileField(upload_to='disegni/', blank=True, null=True)
>
> class Meta:
> managed = False
> db_table = 'disegni'
>
> the forms is:
> class DisegniForm(forms.ModelForm):
> 
> class Meta:
> model = Disegni
> fields = ('iddisegni', 'descrizione', 'revisione', 'file')
> labels = {'descrizione':'Descrizione', 'revisione':'Revisione', 
> 'file':'File'}
>
>
> The settings.py is:
>
> STATIC_URL = '/static/'
> MEDIA_URL = '/media/'
> STATIC_ROOT = "E:/dngo/mysite/polls/static"
> MEDIA_ROOT = "E:/dngo/mysite/polls/media"
>
> the template is generated 
>
> The template is just : 
>
> {% load static %}
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
> Salva
>
>
>
> I never get errors but the file is not uploaded
> Where is my mistake?
>
> -- 
> 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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a8713cc3-2a4c-42ba-8c54-976e1a4b8090%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/10944f55-6262-4743-889d-821f4cea1567%40googlegroups.com.


Re: media file upload

2019-09-18 Thread mohammed habib
Make sure to add ‘enctype="multipart/form-data"’ to your form tag, so that the 
file data is included in when the form is submitted

https://stackoverflow.com/questions/4526273/what-does-enctype-multipart-form-data-mean

Sent from my iPhone

> On 18 Sep 2019, at 17:38, Luca Bertolotti  wrote:
> 
> Hello i can't upload the file, i'm in a debug mode:
> 
> the urls.is:
> 
> from django.contrib import admin
> from django.urls import path, include
> from django.conf import settings
> from django.conf.urls.static import static
> 
> 
> urlpatterns = [
> path('', include('polls.urls')), 
> path('admin/', admin.site.urls),
> 
> 
> ]
> if settings.DEBUG is True:
> urlpatterns += static(settings.MEDIA_URL, 
> document_root=settings.MEDIA_ROOT)
> 
> The model is:
> 
> class Disegni(models.Model):
> iddisegni = models.AutoField(primary_key=True)
> descrizione = models.CharField(max_length=45, blank=True, null=True)
> revisione = models.CharField(max_length=45, blank=True, null=True)
> file = models.FileField(upload_to='disegni/', blank=True, null=True)
> 
> class Meta:
> managed = False
> db_table = 'disegni'
> 
> the forms is:
> class DisegniForm(forms.ModelForm):
> 
> class Meta:
> model = Disegni
> fields = ('iddisegni', 'descrizione', 'revisione', 'file')
> labels = {'descrizione':'Descrizione', 'revisione':'Revisione', 
> 'file':'File'}
> 
> 
> The settings.py is:
> 
> STATIC_URL = '/static/'
> MEDIA_URL = '/media/'
> STATIC_ROOT = "E:/dngo/mysite/polls/static"
> MEDIA_ROOT = "E:/dngo/mysite/polls/media"
> 
> the template is generated 
> 
> The template is just : 
> 
> {% load static %}
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
> Salva
>
> 
> 
> I never get errors but the file is not uploaded
> Where is my mistake?
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a8713cc3-2a4c-42ba-8c54-976e1a4b8090%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/08BB5D00-BF13-4D0F-83EA-BCBAB929AB1C%40gmail.com.


media file upload

2019-09-18 Thread Luca Bertolotti
Hello i can't upload the file, i'm in a debug mode:

the urls.is:

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static


urlpatterns = [
path('', include('polls.urls')), 
path('admin/', admin.site.urls),


]
if settings.DEBUG is True:
urlpatterns += static(settings.MEDIA_URL, 
document_root=settings.MEDIA_ROOT)

The model is:

class Disegni(models.Model):
iddisegni = models.AutoField(primary_key=True)
descrizione = models.CharField(max_length=45, blank=True, null=True)
revisione = models.CharField(max_length=45, blank=True, null=True)
file = models.FileField(upload_to='disegni/', blank=True, null=True)

class Meta:
managed = False
db_table = 'disegni'

the forms is:
class DisegniForm(forms.ModelForm):

class Meta:
model = Disegni
fields = ('iddisegni', 'descrizione', 'revisione', 'file')
labels = {'descrizione':'Descrizione', 'revisione':'Revisione', 
'file':'File'}


The settings.py is:

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = "E:/dngo/mysite/polls/static"
MEDIA_ROOT = "E:/dngo/mysite/polls/media"

the template is generated 

The template is just : 

{% load static %}



{% csrf_token %}
{{ form.as_p }}
Salva
   


I never get errors but the file is not uploaded
Where is my mistake?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a8713cc3-2a4c-42ba-8c54-976e1a4b8090%40googlegroups.com.