How to solve Access to fetch at 'https://api.amadeus.com/v1/flight-offers' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access contro

2024-04-21 Thread Эля Min
I have this one:from django.middleware.common import MiddlewareMixin from django.http import JsonResponse class CorsMiddleware(MiddlewareMixin): def process_request(self, request): if request.method == "OPTIONS" and "HTTP_ACCESS_CONTROL_REQUEST_METHOD" in request.META:

Re: how to save response 's render file to server or email using httpresponse

2012-07-03 Thread Min Hong Tan
\(^o^)/ On Tue, Jul 3, 2012 at 4:53 PM, Nikolas Stevenson-Molnar < nik.mol...@consbio.org> wrote: > You are welcome. Glad you got it working :) > > _Nik > > > On 7/3/2012 3:33 PM, Min Hong Tan wrote: > > Thx nik, > > I'm confused , your words has aroused

Re: how to save response 's render file to server or email using httpresponse

2012-07-03 Thread Min Hong Tan
tps://docs.djangoproject.com/en/dev/topics/email/?from=olddocs/#django.core.mail.EmailMessage > > You won't use HttpResponse at all, just EmailMessage (using > message.attach). > > _Nik > > > On 7/3/2012 1:34 PM, Min Hong Tan wrote: > > sorry all, maybe i'm not typ

Re: how to save response 's render file to server or email using httpresponse

2012-07-03 Thread Min Hong Tan
ou would use an HttpResponse when sending an > email. > > _Nik > > On 7/3/2012 11:20 AM, Min Hong Tan wrote: > > hi, > > > > I have a problem to send mail using Emailmessage, > > i wan to attach the file that render using httpresponse and send, but > > always sho

how to save response 's render file to server or email using httpresponse

2012-07-03 Thread Min Hong Tan
hi, I have a problem to send mail using Emailmessage, i wan to attach the file that render using httpresponse and send, but always show me "int" does not have method "lower". therefore, I think to save the file in the server and then attach using emailmessage. but how do i get the httpresonse to

Re: Advices on what web programming language used in template?

2012-07-03 Thread Yu Min
于 2012年07月03日 19:09, kenneth gonsalves 写道: could you clarify your question please? Do you want to know what programming language is to be used in templates? Or do you want to know what programming language is to be used to program templates? Sorry for not make myself clear. What I am wondering

Advices on what web programming language used in template?

2012-07-03 Thread Yu Min
hi, guys I'm going through django structure. And while struggling to understand the django usage, I start to wonder what web programing language goes well with the template system. Will you guys kindly enough to give me some advice on this please! -- You received this message because

mssql

2012-06-07 Thread Min Hong Tan
hi all, i'm going to use django-mssql. is there any one has use this b4? and any working example? am i need to define a model in models.py?? how if i run syndb. will it sync to my default. mysql database? Regards, MH -- You received this message because you are subscribed to the Google Groups

list indices must be integers, not str

2012-06-01 Thread Min Hong Tan
Hi all, My error msg when i trying to pass character instead of decimal value through the URL pattern URL Link: /project1/program1_add/DUM014749/ URLS.py url(r'^program1_add/(?P\w{1,13})/$', 'view.program_common_add''), Is there any way to pass character instead of value? Regards, MH

Re: output string for template render object

2012-05-27 Thread Min Hong Tan
hi Chew, Thanks. I have found out the html code that i render is invalid. :P too tire for late night programming Regards, MH On Sun, May 27, 2012 at 11:17 AM, Chew Kok Hoor <kokh...@gmail.com> wrote: > Hi Min Hong, > > I think you need to provide a simple exa

output string for template render object

2012-05-27 Thread Min Hong Tan
hi all, i have one question return render_to_response(mainPageTemplate, {'programs':find_program , 'generate_html':generate_html, 'generate_script':generate_script },

django connect alternate database.

2012-05-25 Thread Min Hong Tan
hi, I have a situation. currently i have one default django 's database. but, i wound like to connect to mssql/other database. - how can i get connected to ms-sql/other database? - is it we have to create class in models? the database is for read only. Hope able to get the information. Regards,

model form_set can not delete

2012-05-23 Thread Min Hong Tan
Hi there, i have a problem whereby, if i for form in formset line by line and run form.save(). my delete (ticked) item will not be deleted. and if i 'm direct using formset.save(). it did deleted. where am i code wrong already? q1 = modelformset_factory(CustomerDetail,

Re: user.set_password('new password')

2012-05-19 Thread Min Hong Tan
thanks all :) On Sat, May 19, 2012 at 9:49 AM, Timothy Makobu <makobu.mwambir...@gmail.com > wrote: > user.save returns the function object, which is a valid statement, so > Python wont raise an Exception. > > > On Sat, May 19, 2012 at 9:23 AM, Min Hong Tan <tan.dja...@

Re: user.set_password('new password')

2012-05-19 Thread Min Hong Tan
hi.. thanks!! haha... didn't notice that. how can no error...prompt out one On Fri, May 18, 2012 at 11:48 PM, Jonathan D. Baker < jonathandavidba...@gmail.com> wrote: > Save is a method, so it needs parentheses: user.save() > > Sent from my iPhone > > On May 18, 2012,

user.set_password('new password')

2012-05-18 Thread Min Hong Tan
Hi, I 'm trying to change password in views.py in one of my def. having the below code. newpassword ="testing123" user = User.objects.get(username__exact = request.user) user.set_password(newpassword) user.save it didn't prompt me any error. but, why my password still remained unchanged?

Re: Can't locate 'media' directory

2012-05-17 Thread Min Hong Tan
ROOT_PATH is, on > an HTML page? > > > On Wed, May 16, 2012 at 3:55 PM, Min Hong Tan <tan.dja...@gmail.com>wrote: > >> hi, >> >> your media folder location should be >> >> /media >> >> example: your ROOT_PATH is c:\project\ajax_tut >> t

Re: Can't locate 'media' directory

2012-05-16 Thread Min Hong Tan
hi, your media folder location should be /media example: your ROOT_PATH is c:\project\ajax_tut then your media file should be c:\project\ajax_tut\media MEDIA_ROOT = os.path.join(ROOT_PATH, 'media') MEDIA_URL = '/media/ ' < like this should be ok. you

Re: Disable ModelChoiceField field in ModelForm

2012-05-12 Thread Min Hong Tan
problem solved. from django.forms import ModelForm,Select prg_type = forms.ModelChoiceField(queryset=ProgramType.objects.all(),widget=Select(attrs={'disabled':'disabled'})) in forms.py On Sat, May 12, 2012 at 4:53 PM, Min Hong Tan <tan.dja...@gmail.com> wrote: > hi, > > I have

Disable ModelChoiceField field in ModelForm

2012-05-12 Thread Min Hong Tan
hi, I have a foreign field show in the modelform, and i wish to disable it, may i know how to disable it in modelform? i tried attrs={'disabled':'disabled} but, it prompt doesn't have attrs attribute. Regards, MH -- You received this message because you are subscribed to the Google Groups

Re: disabled or readonly field 's problem

2012-05-12 Thread Min Hong Tan
an" methods of the form. The documentation is > here<https://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-a-specific-field-attribute> > . > > On Sat, May 12, 2012 at 8:56 AM, Min Hong Tan <tan.dja...@gmail.com>wrote: > >> hi, >> >> i have a problem

disabled or readonly field 's problem

2012-05-11 Thread Min Hong Tan
hi, i have a problem on the formmodel. basically, to set the field read only and disabled is easy. but, the problem which I facing now, is a bit complicated. - if set field "read-only" field. We can actually modify the record by using web developer tools by press "F12" to modify the record and

unique key error doesn't show using copy record in modelform.

2012-05-10 Thread Min Hong Tan
hi, my scenario as below: - I want to copy existing record and show at the form. then clear the pk and id then it will be able to "add" instead of "update". - all working fine. but, if the record is exist (Unique error). it should prompt unique key 's error. but, in the form.is_valid has no

Re: jquery form post without refresh the page

2012-05-05 Thread Min Hong Tan
i think i use .bind() instead of .live. because .live will add the event everytimes it .html again. Thanks On Sat, May 5, 2012 at 2:22 PM, Min Hong Tan <tan.dja...@gmail.com> wrote: > seems like .html has another problem. it will duplicate itself (even not > seen in the screen).

Re: jquery form post without refresh the page

2012-05-05 Thread Min Hong Tan
seems like .html has another problem. it will duplicate itself (even not seen in the screen). but it did post Number of times when i submit the form. still need to struggling..bugs still exist.. On Sat, May 5, 2012 at 2:17 PM, Min Hong Tan <tan.dja...@gmail.com> wrote: > hi Oscar, &g

Re: jquery form post without refresh the page

2012-05-05 Thread Min Hong Tan
<omede...@gmail.com> wrote: > Hello Min, > > On Saturday, May 5, 2012, 1:36:24 PM, you wrote: > > > hi oscar, > > > it works, but the problem in jquery load didn't refresh the page after I > have loaded. > > it will always use the outdated html. I have tri

Re: jquery form post without refresh the page

2012-05-05 Thread Min Hong Tan
. it will still static and show the last validation error. how you solve this issue? seems like more to javascript itself . Regards, MH On Fri, May 4, 2012 at 11:17 PM, Min Hong Tan <tan.dja...@gmail.com> wrote: > hi oscar, > > Thank you!!! that is awesome! i not even need to mani

Re: jquery form post without refresh the page

2012-05-04 Thread Min Hong Tan
hi oscar, Thank you!!! that is awesome! i not even need to manipulate the form using output data json! thanks! but , $("xxx").live really is important... Regards, MH On Fri, May 4, 2012 at 4:56 PM, Oscar Mederos <omede...@gmail.com> wrote: > Hello Min, > > On Frid

Re: jquery form post without refresh the page

2012-05-04 Thread Min Hong Tan
hi oscar, how do you make use of the particular method to be able to render the form only? as you said make use of the https://docs.djangoproject.com/en/1.4/ref/contrib/csrf/#ajax and it able to render the form instead of page? because i'm using kurtis method, if any validation error, i retrieve

Re: jquery form post without refresh the page

2012-05-04 Thread Min Hong Tan
t; > > Good luck! > -Kurtis Mullins > > On Thu, May 3, 2012 at 1:46 PM, Bill Freeman <ke1g...@gmail.com> wrote: > >> AJAX >> >> You may require a separate view, but maybe not. >> >> If you search for jQuery and AJAX there should be samples. >&

jquery form post without refresh the page

2012-05-03 Thread Min Hong Tan
is there any sample that i can refer to do the ajax style form post without refresh the whole page? or backend form.save validation without refresh my form? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How to pass the username into a parameter in the views.py

2010-01-24 Thread min
Thank you! On Jan 25, 11:51 am, Sam Lai <samuel@gmail.com> wrote: > 2010/1/25 min <inuyasha...@gmail.com>: > > > Hi, everyone. > > > In the first place, I will login to access a web page by my "usename" > > When I signed in, how to send m

How to pass the username into a parameter in the views.py

2010-01-24 Thread min
Hi, everyone. In the first place, I will login to access a web page by my "usename" When I signed in, how to send my "username" into a parmaeter in the views.py @login_required def new_page(request): #how to get the username? form = newForm() variables = RequestContext(request,

Django and jQuery trouble

2009-02-09 Thread min
//127.0.0.1/ajax/ test_1/' + zipcode + '&' + pro + '/' , function(data) {$('#city').attr ({'value':data}); }); OR def test_1(request, zipcode, pro): if zipcode == 'a' and pro == 'b': city = 'c' else: city = '' return HttpResponse(city) Could y

Re: request.GET Problem

2009-02-05 Thread min
Yes, thanks! On Feb 6, 1:19 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Thu, 2009-02-05 at 17:22 -0800, min wrote: > > [...] > > > > > > > If use request.GET['selectM'].strip() in the following example, we can > >

Re: request.GET Problem

2009-02-05 Thread min
Thanks a lot! Regard min On Feb 6, 12:49 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Thu, Feb 5, 2009 at 8:47 PM, min <inuyasha...@gmail.com> wrote: > > > Ok, Thanks! > > > Another thing is that: I can only get one value by request.GET > > ['selec

Re: request.GET Problem

2009-02-05 Thread min
t; is only 'test2'. If I want get all the values which I have selected, how to do that? On Feb 6, 12:24 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Thu, Feb 5, 2009 at 8:22 PM, min <inuyasha...@gmail.com> wrote: > > > Hi. > > > In the following templates

request.GET Problem

2009-02-05 Thread min
Hi. In the following templates file, we can get the value of zip by using ' request.GET['zip'].strip()' in the views.py Zip However, if the 'zip' input was changed into a SelectMultiple widget, like how to get both the value and option from

Re: Trouble with Django and jQuery

2009-02-05 Thread min
Ok, I will try this way. Thank a lot! On Feb 5, 11:50 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On Feb 5, 12:19 pm, min <inuyasha...@gmail.com> wrote: > > > > > > > Hi, everyone. > > > I'm learing Django now. Currently, I have a p

Trouble with Django and jQuery

2009-02-05 Thread min
Hi, everyone. I'm learing Django now. Currently, I have a problem with Django and jQuery. The detail is that: Firstly, I have a form in the forms.py: class TestForm(forms.Form): name = forms.CharField( max_length=30 ) Then, in the views.py: def Test_page(request): form = TestForm()

Re: trouble with Django and javascript

2009-02-01 Thread min
ango-users@googlegroups.com> > > To: Django users <django-users@googlegroups.com> > > Sent: Sun Feb 01 19:52:49 2009 > > Subject: Re: trouble with Django and javascript > > > Thanks for you reply. > > > However, if I change the 'submit' to button, ho

Re: trouble with Django and javascript

2009-02-01 Thread min
s.com> > Sent: Sun Feb 01 19:52:49 2009 > Subject: Re: trouble with Django and javascript > > Thanks for you reply. > > However, if I change the 'submit' to button, how can I submit the form > to the server? > > Regards > min > > On Feb 2, 11:34 am, "Todd O'Bry

Re: trouble with Django and javascript

2009-02-01 Thread min
Thanks for you reply. However, if I change the 'submit' to button, how can I submit the form to the server? Regards min On Feb 2, 11:34 am, "Todd O'Bryan" <toddobr...@gmail.com> wrote: > In addition to displaying the message, it's also submitting the form, > so you see

Re: trouble with Django and javascript

2009-02-01 Thread min
Thanks for you reply. However, if I change the 'submit' to button, how can I submit the form to the server? Regards min On Feb 2, 11:34 am, "Todd O'Bryan" <toddobr...@gmail.com> wrote: > In addition to displaying the message, it's also submitting the form, > so you see

Re: trouble with Django and javascript

2009-02-01 Thread min
Thanks for you reply. However, if I change the 'submit' to button, how can I submit the form to the server? Regards min On Feb 2, 11:34 am, "Todd O'Bryan" <toddobr...@gmail.com> wrote: > In addition to displaying the message, it's also submitting the form, > so you see

Re: trouble with Django and javascript

2009-02-01 Thread min
the text for a second and then the form reloads. > > Change the instead of "submit" and see if that > helps. > > Todd > > > > On Sun, Feb 1, 2009 at 6:05 PM, min <inuyasha...@gmail.com> wrote: > > > First I  have a form: > > > class TestForm(f

Re: trouble with Django and javascript

2009-02-01 Thread min
the text for a second and then the form reloads. > > Change the instead of "submit" and see if that > helps. > > Todd > > > > On Sun, Feb 1, 2009 at 6:05 PM, min <inuyasha...@gmail.com> wrote: > > > First I  have a form: > > > class TestForm(f

Re: trouble with Django and javascript

2009-02-01 Thread min
Besides, I use firefox. On Feb 2, 10:05 am, min <inuyasha...@gmail.com> wrote: > First I  have a form: > > class TestForm(forms.Form): >   name = forms.CharField( max_length=30 ) >   age = forms.CharField( max_length=30 ) > > Then in the views.py: > > d

Re: How to pass the variable which is defined in the views.py to the jQuery function

2009-01-30 Thread min
Regards Min On Jan 31, 8:48 am, Alex Robbins <alexander.j.robb...@gmail.com> wrote: > Yeah, that code would go in the views.py. simplejson is just an easy > way to turn python variables into a string that javascript would be > able to evaluate. > Actually, if you are goin

Re: How to pass the variable which is defined in the views.py to the jQuery function

2009-01-30 Thread min
Thank you very much! So you mean if I want pass the 'tags' list to the javascrip, the your code example should be added in the views.py. After that, I can use the list by using var x = {{variable_to_insert_into_template}} in my javascript? Regards Min On Jan 31, 3:48 am, Alex Robbins

Re: How to pass the variable which is defined in the views.py to the jQuery function

2009-01-30 Thread min
Thanks a lot. Besides, what's the meaning for the 'escape_js' in [var x = "{{ variable|escape_js }}"] ? Regards Min On Jan 30, 4:33 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Thu, 2009-01-29 at 21:11 -0800, min wrote: > > Hi. > > &g

How to pass the variable which is defined in the views.py to the jQuery function

2009-01-29 Thread min
Hi. First, the code in the forms.py: class TestForm(forms.Form): name = forms.CharField( max_length=30 ) Then, the variable is defined in the views.py: def Test_page(request): form = TestForm() show_results = False variable = '' if request.GET.has_key('name'):