Thank you Daniel, I didn't know this! I am going to lookup how to use
session. Thanks!
On Monday, 19 January 2015 17:13:10 UTC+8, Daniel Roseman wrote:
>
> On Monday, 19 January 2015 07:28:14 UTC, Cheng Guo wrote:
>>
>> Hello,
>>
>> I am new to Django and I have run into an issue with views.py.
Hello James:
Thank you very much for spending the time reading and answering this
question, really appreciated!
I complete understand your suggestion of overriding the "save" method in
the "UploadFile" to generate the id before saving. Thank you for pointing
this out.
On the other hand, I
Hello James:
Thank you very much for spending the time reading and answering this
question, really appreciated!
I complete understand your suggestion of overriding the "save" method in
the "UploadFile" to generate the id before saving. Thank you for pointing
this out.
On the other hand, I
On Monday, 19 January 2015 07:28:14 UTC, Cheng Guo wrote:
>
> Hello,
>
> I am new to Django and I have run into an issue with views.py. I
> understand that there is a function behind each view. For a view that I am
> currently writing, it accepts a file upload from user and stores the file
>
I wouldn't decorate them as class methods. You would want to call them from
the objects themselves. For the save_to_disk() method, I was actually
referring to the Django save() method (
https://docs.djangoproject.com/en/1.7/topics/db/models/#overriding-predefined-model-methods
).
As you have it
So in my case, I need to generate a unique id for the file and save it to
disk.
I have a model called UploadFile, so you recommend to add two class methods
to the UploadFile model, like the following?
class UploadFile(models.Model):
@classmethod
def generate_id():
pass
I second moving some (or most) of the functionality to models.py. For
instance, calculating the SHA value should be done as part of the model's
save() function, not done in the view.
Convention dictates that the only code that is placed in the view itself
should be logic related to prepping the
Great, thanks!
On Monday, 19 January 2015 15:46:40 UTC+8, Mike Dewhirst wrote:
>
> On 19/01/2015 6:28 PM, Cheng Guo wrote:
> > Hello,
> >
> > I am new to Django and I have run into an issue with views.py. I
> > understand that there is a function behind each view. For a view that I
> > am
Great, thanks!
--
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 post to this group, send email to
If the operations are model related, why don't move some of those functions
to models.py.
On Mon 19 Jan 2015 at 08:46 Mike Dewhirst wrote:
> On 19/01/2015 6:28 PM, Cheng Guo wrote:
> > Hello,
> >
> > I am new to Django and I have run into an issue with views.py. I
> >
On 19/01/2015 6:28 PM, Cheng Guo wrote:
Hello,
I am new to Django and I have run into an issue with views.py. I
understand that there is a function behind each view. For a view that I
am currently writing, it accepts a file upload from user and stores the
file on the server. To do that, I need
Hello,
I am new to Django and I have run into an issue with views.py. I
understand that there is a function behind each view. For a view that I am
currently writing, it accepts a file upload from user and stores the file
on the server. To do that, I need to:
1. check the file extension is
12 matches
Mail list logo