Re: Twitter API
I am using http://code.google.com/p/python-twitter/ on my own Django website, works like a charm. Are you sure you are using the API correctly? api.PostUpdate(username, password, 'I love python-twitter!') By the way, updating a tweet is impossible, as Twitter doesn't support that. You can delete and insert a new one though. On Dec 27, 10:15 pm, Mario wrote: > Thank you for you suggestions. Btw, I created a mocked-up app and was > testing the functionality of the python-twitter. I read the docs as > posted athttp://media.jesselegg.com/syncr/syncr.app.tweet.html. > > I did a small unit testing and could see the results immediately, but > I could not create or update a twitt via Django. As I pointed out in > my early email, I want to create/update/delete a twitt in django in > lieu of the Twitter front-end. > > I guess my choices at this point in time are either: > > 1. Twyt > 2. Write a wrapper within the model. > > Thanks again. _Mario > > _Mario > On Dec 27, 3:37 pm, Christophe Pettus wrote: > > > On Dec 27, 2009, at 12:31 PM, Mario wrote: > > > > Thank you for replying. Yes, I reviewed python twitter API, but the > > > model or the app is designed to pull down the "twitt". I would like to > > > upload a twitt via Django in lieu of using the Twitter front-end. Any > > > thoughts or suggestions? > > > Perhaps I'm misunderstanding your issue, but the code running in > > Django is just Python. There's nothing magic about it. If you want > > your view functions to access Twitter via a Python Twitter API, it's > > no problem to do so; you can also wrap your calls to Twitter inside of > > a Model class, if that's a better fit. > > > -- > > -- Christophe Pettus > > x...@thebuild.com > > -- 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.
Re: JavaScript function call
What you are doing is not valid html, you can't put a script tag inside a tr tag. Try something like this: showDomainTable('{{v.publisher_id}}', '{{v.country_id}}'); But even then, inline javascript is something better avoided. I would just create a function that is run as soon as the document is loaded, find all tr's inside your table, and use their id's to call your showDomainTable function. If you also need the country id, something like this could work: And then in your javascript code just split on the underscore. I have no clue if you know jQuery? But this would be very easy if you would use jQuery. If you need it, I could give you some mockup code to help you along. On Dec 27, 7:42 pm, "gilbert F." wrote: > Hello, > > I just wonder if somebody has met this problem. I need to call a > javaScript function within "". > > {% for v in data %} > id="{{v.publisher_id}}" > language="JavaScript"> > showDomainTable > ('{{v.publisher_id}}', '{{v.country_id}}'); > > > > > This works well with Firebox but not with IE 8. IE just prints > "showDomainTable(...)" instead of calling it. > > Any help? Thanks so much. -- 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 are already login...I want to get this message when a user is already login to my site(two different location)
Hello all, I want to let only one same user to be login in the same time. If I connect from Paris with admin, and other user try to connect with admin from other location, to get a message like it is already connected. How can I do something like this? -- 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.
Re: You are already login...I want to get this message when a user is already login to my site(two different location)
On Dec 28, 11:26 am, NMarcu wrote: > Hello all, > > I want to let only one same user to be login in the same time. If I > connect from Paris with admin, and other user try to connect with > admin from other location, to get a message like it is already > connected. How can I do something like this? That's not easy. 'Logged in' status is not something that is stored on the server, but on the client (in the session). So the server does not actually know who is logged in at any one time. It does record the last time a particular user logged in, and I suppose you could create a user profile that records the last time the user performed an action, but it's not clear how you would determine that a user had logged out or that the session had expired. -- DR. -- 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.
eric ide for support django working
hi man ı use the eric ide for django development at start. but ı don't work the django project. ı install django plugin then new django-python project and ı edit the file urls the choose project a select screen and django-admin.py startproject a Django project created successfully. then ı add the exist file for my project and ı saw url,view,int ext.. but ı dont know then. can anyone help me ? -- 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.
Re: JavaScript function call
On 28 déc. 2009, at 10:26, Kevin Renskers wrote: > But even then, inline javascript is something better avoided. Especially, in this case, because there is no garantee whatsoever that the element has already been created and added to the document's DOM. -- 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.
Re: You are already login...I want to get this message when a user is already login to my site(two different location)
2009/12/28 Daniel Roseman : > On Dec 28, 11:26 am, NMarcu wrote: >> Hello all, >> >> I want to let only one same user to be login in the same time. If I >> connect from Paris with admin, and other user try to connect with >> admin from other location, to get a message like it is already >> connected. How can I do something like this? > > That's not easy. 'Logged in' status is not something that is stored on > the server, but on the client (in the session). So the server does not > actually know who is logged in at any one time. It does record the > last time a particular user logged in, and I suppose you could create > a user profile that records the last time the user performed an > action, but it's not clear how you would determine that a user had > logged out or that the session had expired. > -- > DR. > > -- Actually i think it is stored on the server. You only get cookie in your browser with the sessions key and session is stored in django_session table in your database, and each record has session key and expire time (providing you use SessionMiddleware). You could override the login view to check if the user is logged in or not and has the session expired. Though i _think_ you would need to modify/hack the django.contrib.admin to use your login view rather the the one built into django. But all this seems a bit clumsy. I had a case where we should let one type of users login only after the correct amount of other type of users had been registered. But this was only for site login and none of the plain users could use admin. So we just overrided built in login view. It looks something like: @csrf_protect @never_cache def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME, authentication_form=None): users = User.objects.filter(user_type="some_type").aggregate(Count('id')) if users['id__count'] > 50: from django.contrib.auth.views import login return login(request, template_name, redirect_field_name, authentication_form) else: raise SomeError # Or mess with POST data so the auth fails This could be done much more elegantly with lower level API but this was "just make it work" solution. Instead of counting users you could say if request.user.is_authenticated(): return HttpResponseRedirect(reverse('home')) In this example if the user is authenticated he gets redirected to some home page of his/hers. You can look in from django.contrib.auth.views.login source and see how the developers do it and then copy the login function and work your magic there but still you should hack the django.contrib.admin to use that new login AFAIK. It's not a perfect solution but it's all I've got ATM. Davor -- 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.
Re: Binary Post Data to ImageField
After some digging, I finally worked it out. In case anyone is interested, here is the code for Django: from django.core.files.uploadedfile import SimpleUploadedFile def set_user_image(request, img_id): """ set/update a user's image """ if not request.user.is_authenticated(): return HttpResponse(status=403) # get the profile for the logged on user profile = get_object_or_404(GenericProfile, user = request.user) # instantiate an uploaded file to be passed to the model upfile = SimpleUploadedFile("%s.jpg" % img_id, request._raw_post_data, "image/jpeg") # update the user profile profile.image.save("%s.jpg" % img_id, upfile, True) return HttpResponse() This code lacks important functionality though, e.g. check if the file is a valid JPEG image, check if img_id is valid, etc. So basically all you have to do is create a new SimpleUploadFile object and initialize it with the raw POST data. Of course the client has to use the correct format; in Flex, I did something like this: var req:URLRequest = new URLRequest(baseURL + "setimage/" + _field); req.method = "POST"; req.data = jpData; /* this is the ByteArray containing JPEG data */ req.contentType = "image/jpeg"; var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, uploadOK); loader.addEventListener(IOErrorEvent.IO_ERROR, uploadFault); loader.load(req); To all you Django gurus out there: is this a sensible approach? Thanks and happy holidays! Markus -- 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.
Re: JavaScript function call
Hi Kevin, Thanks so much for your replies. Following your suggestions I have moved tag out of.