After revising python basics, here's how I'd structure it - On 22 September 2010 18:10, jake2891 <leahy_r...@hotmail.com> wrote: > Hey guys, i am using extjs in django and am wondering the correct way > to build custom classes like file upload classes and classes of > functions.
I'm assuming by 'file upload classes' you mean file upload views, i.e. the code responsible for receiving the file upload. If so, they're just like any other view. In Django though, you might want to consider putting file validation and processing code into your forms.py or models.py for better abstraction and reusability. For 'classes of (useful) functions', put them wherever they make sense. As mentioned, they don't need to be classes - you can just have files with functions in them. Use classes only when a class makes sense. If they're only applicable in one app, put them in a file in that app. You might want to use different files to separate the functions into different namespaces. > I am a bit confused does everything have to go into > views.py by defining a function for each ajax request or what is the > process? As with extjs like drop downs make an ajax request to > populate them with data do all of these for all of my fields go into > the view or can i create a custom class of methods and just use the > views for rendering the forms. thanks Yep, they're just like every other view. You could use some python magic to reuse the same view for different but related AJAX requests and avoid repetition. You might want to consider putting the code for getting the data in your form, so you can easily create an alternative non-AJAX form. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.