Search Results

Search found 230 results on 10 pages for 'zjm1126'.

Page 8/10 | < Previous Page | 4 5 6 7 8 9 10  | Next Page >

  • how to made a "admin-only" for in html page (not view.py),has this method :user.is_superuser ??

    - by zjm1126
    in views.py: @user_passes_test(lambda u: u.is_superuser) def h_view(request): return render_to_response('mytest/news.html',context_instance=RequestContext(request)) but i want to show this page when admin login,and my now page is : <li id="tab_mytest"><a href="{% url mytest_list %}" class="{% block mytest_css_name %}{% endblock %}">{% trans "mytest" %}</a></li> how to change it, has this method :user.is_superuser ?? thanks

    Read the article

  • gaema twitter handle error..

    - by zjm1126
    i use gaema for twitter user loggin http://code.google.com/p/gaema/ and my code is : class TwitterAuth(WebappAuth, auth.TwitterMixin): pass class TwitterHandler(BaseHandler): def get(self): twitter_auth = TwitterAuth(self) try: if self.request.GET.get("oauth_token", None): twitter_auth.get_authenticated_user(self._on_auth) self.response.out.write('sss') return twitter_auth.authorize_redirect() except RequestRedirect, e: return self.redirect(e.url, permanent=True) self.render_template('index.html', user=None) def _on_auth(self, user): """This function is called immediatelly after an authentication attempt. Use it to save the login information in a session or secure cookie. :param user: A dictionary with user data if the authentication was successful, or ``None`` if the authentication failed. """ if user: # Authentication was successful. Create a session or secure cookie # to keep the user logged in. #self.response.out.write('logged in as '+user['first_name']+' '+user['last_name']) self.response.out.write(user) return else: # Login failed. Show an error message or do nothing. pass # After cookie is persisted, redirect user to the original URL, using # the home page as fallback. self.redirect(self.request.GET.get('redirect', '/')) and the error is : Traceback (most recent call last): File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__ handler.get(*groups) File "D:\zjm_code\gaema\demos\webapp\main.py", line 76, in get twitter_auth.authorize_redirect() File "D:\zjm_code\gaema\demos\webapp\gaema\auth.py", line 209, in authorize_redirect http.fetch(self._oauth_request_token_url(), self.async_callback( File "D:\zjm_code\gaema\demos\webapp\gaema\auth.py", line 239, in _oauth_request_token_url consumer_token = self._oauth_consumer_token() File "D:\zjm_code\gaema\demos\webapp\gaema\auth.py", line 441, in _oauth_consumer_token self.require_setting("twitter_consumer_key", "Twitter OAuth") TypeError: require_setting() takes at most 2 arguments (3 given) thanks

    Read the article

  • scrollTop in defferent browers.

    - by zjm1126
    shortcut.add("up",function() { alert( document.body.scrollTop) if (document.documentElement&& typeof document.documentElement.scrollTop=='number'){ document.documentElement.scrollTop-=100 } else if (document.body) { document.body.scrollTop-=100 } }) shortcut.add("down",function() { if (document.documentElement&&typeof document.documentElement.scrollTop=='number' ){ document.documentElement.scrollTop+=100 } else if (document.body) { document.body.scrollTop+=100 } }) it can running in firefox,but not in chrome and safari thanks

    Read the article

  • how to get the parent dir location using python..

    - by zjm1126
    this code is get the templates/blog1/page.html in b.py: path = os.path.join(os.path.dirname(__file__), os.path.join('templates', 'blog1/page.html')) but i want to get the parent dir location: a |---b.py |---templates |--------blog1 |-------page.html and how to get the a location thanks

    Read the article

  • How do I make the info window editable in the Google Maps API?

    - by zjm1126
    I would like to make the info window editable when i click on it. This is my code: <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width,minimum-scale=0.3,maximum-scale=5.0,user-scalable=yes"> </head> <body onload="initialize()" onunload="GUnload()"> <style type="text/css"> *{ margin:0; padding:0; } </style> <!--<div style="width:100px;height:100px;background:blue;"> </div>--> <div id="map_canvas" style="width: 500px; height: 300px;"></div> <div class=b style="width: 20px; height: 20px;background:red;position:absolute;left:700px;top:200px;"></div> <div class=b style="width: 20px; height: 20px;background:red;position:absolute;left:700px;top:200px;"></div> <script src="jquery-1.4.2.js" type="text/javascript"></script> <script src="jquery-ui-1.8rc3.custom.min.js" type="text/javascript"></script> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA-7cuV3vqp7w6zUNiN_F4uBRi_j0U6kJrkFvY4-OX2XYmEAa76BSNz0ifabgugotzJgrxyodPDmheRA&sensor=false"type="text/javascript"></script> <script type="text/javascript"> var aFn; //********** function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); var center=new GLatLng(39.9493, 116.3975); map.setCenter(center, 13); aFn=function(x,y){ var point =new GPoint(x,y) point = map.fromContainerPixelToLatLng(point); //console.log(point.x+" "+point.y) var marker = new GMarker(point,{draggable:true}); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml("<b>wwww</b>"); }); map.addOverlay(marker); /********** var marker = new GMarker(point, {draggable: true}); GEvent.addListener(marker, "dragstart", function() { map.closeInfoWindow(); }); GEvent.addListener(marker, "dragend", function() { marker.openInfoWindowHtml("????..."); }); map.addOverlay(marker); //*/ } $(".b").draggable({ revert: true, revertDuration: 0 }); $("#map_canvas").droppable({ drop: function(event,ui) { //console.log(ui.offset.left+' '+ui.offset.top) aFn(event.pageX-$("#map_canvas").offset().left,event.pageY-$("#map_canvas").offset().top); } }); } } </script> </body> </html>

    Read the article

  • does webapp has 'elseif' or 'elif' in template tags..

    - by zjm1126
    my code is : Hello!~~~ {% if user %} <p>Logged in as {{ user.first_name }} {{ user.last_name }}.</p> {% elif openid_user%} <p>Hello, {{openid_user.nickname}}! Do you want to <a href="{{openid_logout_url}}">Log out?</p> {% else %} <p><a href="/login?redirect={{ current_url }}">google Log in</a>.</p> <p><a href="/twitter">twitter Log in</a>.</p> <p><a href="/facebook">facebook Log in</a>.</p> <p><a href="{{openid_login_url}}">openid Log in</a>.</p> <iframe src="/_openid/login?continue=/"></iframe> {% endif %} the error is : TemplateSyntaxError: Invalid block tag: 'elif' does not webapp has a 'else if ' ? thanks

    Read the article

  • why my code show messy code ..

    - by zjm1126
    class sss(webapp.RequestHandler): def get(self): url = "http://www.google.com/" result = urlfetch.fetch(url) if result.status_code == 200: self.response.out.write(result.content) and this view show : when i change code to this: if result.status_code == 200: self.response.out.write(result.content.decode('utf-8').encode('gb2312')) it show : so ,what i should do ? thanks

    Read the article

  • how to make a thread of never stop, and write something to database every 10 second..

    - by zjm1126
    i using gae and django this is my code: class LogText(db.Model): content = db.StringProperty(multiline=True) class MyThread(threading.Thread): def __init__(self,threadname): threading.Thread.__init__(self, name=threadname) def run(self,request): log=LogText() log.content=request.POST.get('content',None) log.put() def Log(request): thr = MyThread('haha') thr.run(request) return HttpResponse('')

    Read the article

  • how to get $(foot,'> .t') in my code, i using jquery..

    - by zjm1126
    var foot = document.createElement("div"); $('<div class="t"></div><div class="b"></div>').appendTo(foot); foot.id='foot'; //***** $(foot,'> .t').mouseover(function(){...}) i want to get the '.t' div element, but now ,the 'foot' div is not already appenTo the 'document.body' , so i can't use this $('#foot .t'), and i use this:$(foot,' .t'), but ,i get the $(foot), so how do i get the foot's '.t' element using jquery thanks

    Read the article

< Previous Page | 4 5 6 7 8 9 10  | Next Page >