These are chat archives for django/django

Apr 2017
Apr 12 2017 13:35

can i create a function in where every time user upload some file then that function automate update the name of model with the filename or filepath because i use multi upload file and user cant gine name in the field name.

my model

class book(models.Model):
    user = models.ForeignKey(User)
    name = models.CharField(max_length=255)
    upload = models.FileField(upload_to='images')
Mark Winterbottom
Apr 12 2017 15:01
@cs89gr you could override save() on the model
Check the image name and assign that to name
Apr 12 2017 15:05
@LondonAppDev how to do that ?
Mark Winterbottom
Apr 12 2017 15:07
How do you override the save function?
Apr 12 2017 15:11
@LondonAppDev i want automate for ex if file name is likes this 'aaaaaaaaaaa.file' then name take that name from file upload automate
Mark Winterbottom
Apr 12 2017 15:14

ok... so do this:
1) Look up how to properly override the save() function a model using the Django docs and/or the SO link I sent above
2) Find out how to extract the name of the uploaded file on a FileField (
3) Set the name field to the name of the file in the FileField in save.

Also you may want to consider switching FileField for ImageField (

Dave Merwin
Apr 12 2017 16:21
Hey folks. I'm looking for some recommendations for apps that can do the following: Allow me to login, create a team and invite members to that team. I love Django Allauth, looking for other app recomendations for the team and invites bit
Apr 12 2017 17:36
@LondonAppDev , love the teaching method :+1:
take'em to water, but make them drink
Mark Winterbottom
Apr 12 2017 18:01
lol :D
Thanks @flyboy1565
Dave Merwin
Apr 12 2017 18:25
Anyone know how to add a save button to the top of a list view in Django Admin for list_editable?
Apr 12 2017 18:38
Hi guys, I have a question related to Single Page Application and SEO. I am trying to build my side project as Single Page Application with REST backend, but friend of mine told me it would be difficult to promote this kind of web apps in Google, because Google will not always evaluate JS or even if it does, they will not wait more than 100ms of your AJAX requests. SPA is very convenient for end-users, but seems not for crawlers. What is the options for the next steps?
Who did what in this situation and able to save performance/SEO/convenience for end-users?
William Hakizimana
Apr 12 2017 22:56
Quick question for you all. So if I receive the following from an NFC reader what is the best practice to parse the information after the question mark into the database?