I create a simple Django authentication app and work fine. now I want to add a
python script where to can do some simple image processing. my python script
for processing work fine and I put in the views.py. my question is the new
image created from the script how to can add back to image from mymodel ?first
must be save temporarily ? can I do this ? sorry I am new.
class MyModel(models.Model):
user = models.ForeignKey(to=settings.AUTH_USER_MODEL)
image = models.ImageField(upload_to=generate_path(self.user))
forms.py
@login_required
class CronForm(forms.Form):
days = forms.ModelChoiceField(queryset=MyModel.objects.all)
views.py
@login_required
def show_something(request,user_id):
user = UserProfile.objects.get(user__id=user_id)
form = CronForm()
if request.method == "POST":
form = CronForm(request.POST)
if form.is_valid:
# do image processing
# do image processing
# and finaly ta ke new image from the image processing like
newim='newim.tif'
return HttpResponseRedirect(...)
errors = form.errors or None
return render(request, 'path/to/template.html',{
'form': form,
'errors': errors,
})
--
https://mail.python.org/mailman/listinfo/python-list