These are chat archives for django/django

Feb 2016
Feb 10 2016 09:58
hi ..
i want to upload image file in django ... from web page .. but i am not getting it

my code is like this
def content_file_name(instance, filename):
fname = filename.split('.')
fname[0] = instance.user.username + '.' + fname[1]
return '/'.join(['image',fname[0]])

class Preference(models.Model):
user = models.ForeignKey(User)

`timezone_positive = models.BooleanField()`
`timezone_hours = models.SmallIntegerField()`
`timezone_minutes = models.SmallIntegerField()`
`image = models.ImageField(upload_to=content_file_name)`

`def __str__(self):`
    `return self.user.username`
and is ...
@authentication_classes((SessionAuthentication, BasicAuthentication))
def image_submit(request):
print type(['file']),request.FILES
preference = Preference.objects.get(pk=2)
preference.image = request.FILES['file']
print preference.image
print "success"
return Response({'data':'a'})
Feb 10 2016 10:16
problem solved :)
Jon Earley
Feb 10 2016 19:21
Hey, all! Anyone hiring a Django developer?
Omar Quimbaya
Feb 10 2016 20:44
we are!
Feb 10 2016 21:40

hello i have some python scripts with mathematical functions and i want to upload on my website to help the user to take results for some mathematical problem,but i dont know how to written on my and template tag for example one my script:

total_inputs= int(input("number of numbers to input: "))
   for i in range (total_inputs)
    Num = input("Enter a number: ")

user define the number to want for input and next input integer numbers on the list(NList) that list go to progress and exported one variable result outpout and list of variables results. i dont upload the progress code because i think not is nesecery for my questions.

Răzvan Ionescu
Feb 10 2016 21:41
@WritingPanda remote also