Re: pymssql: Problem with Unicode string
sorry, let me correct some row: --- import pymssql conn = pymssql.connect(host='testserver', user='sa', password='sa', database='testdb', as_dict=True) crms = conn.cursor() crms.execute('SELECT cc_Name FROM tblUsers') for line in crms.fetchall(): print 'cc_Name:', line['cc_Name'] break crms.close() --- I guess that the returned data from crms.execute() is non unicode data!!! If that is case, how to get unicode data!!! Things getting even worse as time goes by. please give me your hand! regards, Orgil -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
pymssql: Problem with Unicode string
Hello! I am using pymssql-1.9.908. And I have MSSQL2008 database server. I ran following code from python 2.6: --- import pymssql conn = pymssql.connect(host='testserver', user='sa', password='sa', database='testdb', as_dict=True) crms = conn.cursor() crms.execute('SELECT cc_Name FROM tblUsers') for line in crms.fetchall(): print 'cc_Name:', self.unicodify(line['cc_Name']) break crms.close() --- the result is-> cc_Name: ?, ??? But the actual data is "Аймаг, хот" and I expect that the output would be "cc_Name: Аймаг, хот". Here is my question: How to get Unicode data from MSSQL database using pymssql library? Any suggestion would be highly appreciated! regards, Orgil.D -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
Facebook session problems.
I managed to log into facebook using the graph api, I store the FB id and tie it to a User, like this class FacebookUser(models.Model): user= models.ForeignKey(User) fb_uid = models.CharField( max_length=100, blank = True, unique = True ) access_token= models.CharField( max_length=100, blank = True, null = True ) def __unicode__(self): if self.user.username == u'': return str(self.pk) return self.user.username after I get the user I do the following: user = auth.authenticate(username=user.username, password=password) if user is not None and user.is_active: auth.login(request, user) I log in and all is good except I loose the session if I go to another web site and come back. Any help or advice greatly appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Django cache created in one function not available to another?
On Sat, Jan 29, 2011 at 9:30 PM, Rob Hudsonwrote: > This sounds similar to this bug : > http://code.djangoproject.com/ticket/15149 If the OP is using Django 1.2.3, this probably isn't #15179 -- Jeff reports that if he rolls back to before the recent key prefixing changes, his problem doesn't exist. Those changes don't exist on the 1.2.X branch. > On Jan 28, 8:02 am, Lance Vick wrote: >> So I have a function that sets cache (and successfully outputs it): >> >> def push_cache: >> cache.set('foo_cache', 'FUBAR!!!') >> foodata = cache.get('foo_cache') >> print(foodata) # this works >> >> However when I try to access that cache from within a view and >> directly output it it returns None: >> >> def fetch_cache(request): >> cache_data = cache.get('foo_cache') >> return HttpResponse(cache_data) #this does not work. >> >> Am i misunderstanding something fundamental in how cache works? >> >> I am using the memcached backend in django 1.2.3 The fundamental calls to caching are correct usage, but your usage is missing something important -- caches aren't guaranteed to return a value. Cache values expire, so your code *must* allow for the case where the cache returns nothing. That said, if you're pushing a value into the cache, and you're not getting the value coming out on the fetch, there could be a couple of causes: * If memcached isn't running (or nor running correctly, or not running on the right port, or not running on a port that is allowing connections, etc), caching will fail, returning empty results. * If the default timeout for the cache is short, the cache may be expiring before the fetch operation is performed. We'd need to see your cache settings to confirm the second issue; the first issue is something you'll have to investigate yourself. The easiest way to test this is to fire up a python shell prompt and try using the cache programatically. You might also want to try using a different cache backend -- that will allow you to work out if the problem is your usage of caching, or your memcache configuration. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: ANN: Server upgrade on djangoproject.com
On Sun, Jan 30, 2011 at 12:29 PM, creecodewrote: > Hello Jacob, > > On Jan 28, 12:33 pm, Jacob Kaplan-Moss wrote: > >> I'm starting the switchover to the new djangoproject.com server right >> now. > > The source listings seem to visually cut off code. I don't recall > seeing this issue before the upgrade. What exactly do you mean by "visually cut off code"? Can you give a specific URL that demonstrates the problem you're talking about? Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Google maps
Hi This also depends how server-side oriented you want this to be? Its good to learn geodjango. (that way if your calculation areas of polygons, loading layers you can just make this python+server side instead of writing it in javascript. Also with lots of ajax related request/response designs some people look at using dajax or something like that to reduce development time. cheers sam_w On Sat, Jan 29, 2011 at 12:17 AM, Michaelwrote: > You might take a look at > https://launchpad.net/ubuntu-django-foundations/map > > It's a fairly new project, but is actively being developed. > > -- > Michael > > On Thu, 2011-01-27 at 21:23 -0800, roy mukasa wrote: >> Hey guys does anyone know how i can embed google maps into django? i >> am new to django but i am trying to develop an app in which i will >> embed a google map of a particular area. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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: ANN: Server upgrade on djangoproject.com
Hello Jacob, On Jan 28, 12:33 pm, Jacob Kaplan-Mosswrote: > I'm starting the switchover to the new djangoproject.com server right > now. The source listings seem to visually cut off code. I don't recall seeing this issue before the upgrade. Thanks, creecode -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: How to format a datetime in a webpage?
Thank you very much! I misunderstood the meaning of "date" and "the time of day"... On Fri, Jan 28, 2011 at 8:53 PM, Jirka Vejrazkawrote: > > {{record.ComplaintTime|time:"Y-m-d > > H:i"}} > > From the documentation: > > "The time filter will only accept parameters in the format string that > relate to the time of day, not the date (for obvious reasons). If you > need to format a date, use the date filter." > > So, you need to use: >{{record.ComplaintTime|date:"Y-m-d > H:i"}} > > instead of: > {{record.ComplaintTime|time:"Y-m-d > H:i"}} > > Cheers > >Jirka > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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.
Styleled Form in login generic views
Hi, How to get a 'class=inputStyle' on a form in generic login view? -- Daniel Corbe Hahne Latorre dan...@corbe.com.br 55 48 9618-5115 skype: daniel_corbe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Django Admin - list_display doesn't follow FK links?
Hey Victor, - I changed my subscription to my gmail-account because I'm not sure if my email went trough. Here is it again. - I do the following to get data out of a related table/model: Of course you could access your other model via __unicode__... Or, simply write a function for your model and use a callback in your list_display: Here an easy "quick and dirty" example: class othermodel(models.Model) importantfield=models.CharField() class mymodel(models.Model) value = models.CharField() FK_othermodel= models.Foreignkey(othermodel) def get_importantfield(self): return self.FK_othermodel.importantfield In your admin.py call MymodelAdmin(admin.ModelAdmin) list_display=['get_importantfield'] Hope it helps! Mathieu -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
contenttypes and dumpdata options
hello, What's the current recommended way to deal with contenttypes when you move a db using dumpdata? I know about excluding it, but I read something about using the ---natural option with the dump command would work as well. Does this work when including contenttypes in the dump? Which is the preferred method? thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Django Admin - list_display doesn't follow FK links?
Hey Victor, I do the following to get data out of a related table/model: Of course you could access your other model via __unicode__... Or, simply write a function for your model and use a callback in your list_display: Here an easy "quick and dirty" example: class othermodel(models.Model) importantfield=models.CharField() class mymodel(models.Model) value = models.CharField() FK_othermodel= models.Foreignkey(othermodel) def get_importantfield(self): return self.FK_othermodel.importantfield In your admin.py call MymodelAdmin(admin.ModelAdmin) list_display=['get_importantfield'] Hope it helps! Mathieu -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Django Template CSS Load Path
Interestingly, I added TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'django.core.context_processors.media', ) to my settings.py and got this error. Put 'django.contrib.auth.context_processors.auth' in your TEMPLATE_CONTEXT_PROCESSORS setting in order to use the admin application. My vhosts log file shows the css is being fetched. There are no errors. But I am not seeing the page color change to light blue. tnx cmn On Jan 19, 4:02 pm, Matías Iturburuwrote: > On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho < > > eduardocer...@gmail.com> wrote: > > You can use MEDIA_URL conf to get the root path to your media files. > > > > /> > > the above code is correct, just make sure that you are using the media > context processor or returning a RequestContext, not just plain Context. > Check out your settings.py for this one of this in the > TEMPLATE_CONTEXT_PROCESSORS constant. > > 'django.core.context_processors.request', > 'django.core.context_processors.media', > > > > > > > On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus > > wrote: > > >> I am trying to load a css file in my base.html template > > >> > >> > >> > >> {% block title %}Test{% endblock %} > >> > >> > > >> What kind of path is supposed to go in the href? Is it relative to the > >> document root? > > >> Does anyone have an example of loading a css file including the Apache > >> configuration? > > >> Thanks. > >> cmn > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Django users" group. > >> To post to this group, send email to django-users@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. > > > -- > > Eduardo Cereto Carvalho > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@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. > > -- > Matías Iturburuhttp://www.linkedin.com/in/miturburu|http://ltmo.com.ar -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
query did not work
would like to post one bug, since i was sitting 4h on it For some reasons query did not work. In the end appeared that it depends on how urls.py are formulated: urlpatterns = patterns('', (r'^searchbooks','Finnish2.Fin.views.searchbooks'), # page http://127.0.0.1:8000/searchbooks is displayed, query works (r'^SB','Finnish2.Fin.views.searchbooks'), # page http://127.0.0.1:8000/SB is displayed, query does not work, already print query statement in views.searchbooks gives empty string ) Maybe smbd can comment why this happens. according oldmanual http://www.djangobook.com/en/1.0/chapter07/ Finnish2/Fin/ templates/trial/searchbooks.hmtl < ### Finnish2/Fin/ forms.py from django import forms from models import Item class ContactBooksF(forms.Form): serial_number = forms.CharField(widget=forms.Textarea()) ###Finnish2/Fin/ models.py from django.db import models class Item(models.Model): serial_number = models.CharField(max_length=15) ### Finnish2/Fin/ views.py from forms import ContactBooksF from django.shortcuts import render_to_response, def searchbooks(request): query = request.GET.get('q', ''); print 'searchbooks query=', query if query: print 'in query' #see http://www.djangobook.com/en/1.0/chapter07/ return render_to_response("c:/Python27/Scripts/Finnish2/Fin/ templates/trials/searchbooks.html", {"query": query }) }) def contactbooks(request): form = ContactBooksF() return render_to_response('c:/Python27/Scripts/Finnish2/Fin/ templates/trial/contactbooks.html', {'form': form}) ###Finnish2/ urls.py from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^searchbooks','Finnish2.Fin.views.searchbooks'), ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Django Template CSS Load Path
I still cannot get the css page to load. On Jan 19, 4:02 pm, Matías Iturburuwrote: > On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho < > > eduardocer...@gmail.com> wrote: > > You can use MEDIA_URL conf to get the root path to your media files. > > > > /> > My MEDIA_URL is MEDIA_URL = 'http://localhost:8002/' I have added to my base template. I'm not sure what changes I'm supposed to make regarding TEMPLATE_CONTEXT_PROCESSORS. I don't have that constant in my settings.py nor do I have 'django.core.context_processors.request' or 'django.core.context_processors.media' in any of my application files. tnx cmn > the above code is correct, just make sure that you are using the media > context processor or returning a RequestContext, not just plain Context. > Check out your settings.py for this one of this in the > TEMPLATE_CONTEXT_PROCESSORS constant. > > 'django.core.context_processors.request', > 'django.core.context_processors.media', > > > > > > > On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus > > wrote: > > >> I am trying to load a css file in my base.html template > > >> > >> > >> > >>{% block title %}Test{% endblock %} > >> > >> > > >> What kind of path is supposed to go in the href? Is it relative to the > >> document root? > > >> Does anyone have an example of loading a css file including the Apache > >> configuration? > > >> Thanks. > >> cmn > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Django users" group. > >> To post to this group, send email to django-users@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. > > > -- > > Eduardo Cereto Carvalho > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@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. > > -- > Matías Iturburuhttp://www.linkedin.com/in/miturburu|http://ltmo.com.ar -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: need help following tutorial part 1
Quick and dirty solution: python django-admin.py startproject mysite or Add C:\PathToYourDjangoInstall\Scripts\ to your PATH environment variable. This can be done in one of two ways. #1 (EASIER) Open 'System Properties' (hit WindowsKey + PauseBreak, or right-click on My Computer and select 'Properties'). Switch to the 'Advanced' tab, click on 'Environment Variables' on the bottom of the dialog. Find PATH on the 'System Variables' list, double-click. append C:\PathToYourDjangoInstall\Scripts\ to the 'Variable Value'. Don't forget to add a semi-colon. #2 (BETTER) Download and install virtualenv (http://pypi.python.org/pypi/virtualenv) Follow instructions to create a virtual environment in, say, C:\django\virtual\ Create a 'mydjango.bat' batch file anywhere in your computer that sets the PATH for you according to that virtual environment. Create a shortcut pointing to: %windir%\system32\CMD.EXE /K "C:\SomePath\mydjango.bat" Run it whenever you want to work within that environment. I personally use a variation of #2. Sincerely, André Terra On Sat, Jan 29, 2011 at 16:44, Axel Bockwrote: > hm ... my windows times are over quite a while, BUT ... > > 1) try associating the .py extension with the python commandline > interpreter. > 2) syntax error? send a screendump maybe, or your exact command line ... it > _should_ work without problems. > > can you execute other simple python scripts? > > > cheers, > axel. > > > > > 2011/1/29 Panupat > > I'm kinda stuck and would greatly appreciate any help. >> >> I followed these turorials and got Django to install. Was able to >> import Django and print out the version correctly. I'm running >> Apache2.2 on windows 7 with mod_wsgi >> >> http://docs.djangoproject.com/en/1.2/intro/install/ >> >> But moving forward to part 1, It says, cd to the directory and run the >> command >> django-admin.py startproject mysite >> >> This is where I don't understand. >> - running the command from cmd, it says django-admin.py is not >> recognized as command. >> - if I run python first, it says syntax error. >> >> Am I missing something from the tutorial? Does the project need to be >> in a particular folder in order for the .py file to be executable? Is >> there anything else I need to add to windows other than adding C: >> \Python27 to PATH? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@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-users@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-users@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: need help following tutorial part 1
Oh Axel, sorry about that ^_^; The tutorial said I should cd to the directory I want to start my project. So no I wasn't in C:\Python27\Scripts when I typed the command On Jan 30, 2:05 am, Axel Bockwrote: > you should not. are you IN c:\...\scripts when you type in > "django-admin.py"? AFAIK windows adds the current directory always to the > path. > > and it's AXEL ;) > > 2011/1/29 Panupat > > > Hi Alex. Thank you for you suggestion. > > > It seems I can get the script to run if I type out the full path. > > > C:\Python27\Scripts\django-admin.py startprofect mysite > > > C:\Python27 is already added to my windows' PATH. Proably will need to > > add C:\Python27\Scripts to it too. > > > On Jan 30, 1:44 am, Axel Bock wrote: > > > hm ... my windows times are over quite a while, BUT ... > > > > 1) try associating the .py extension with the python commandline > > > interpreter. > > > 2) syntax error? send a screendump maybe, or your exact command line ... > > it > > > _should_ work without problems. > > > > can you execute other simple python scripts? > > > > cheers, > > > axel. > > > > 2011/1/29 Panupat > > > > > I'm kinda stuck and would greatly appreciate any help. > > > > > I followed these turorials and got Django to install. Was able to > > > > import Django and print out the version correctly. I'm running > > > > Apache2.2 on windows 7 with mod_wsgi > > > > >http://docs.djangoproject.com/en/1.2/intro/install/ > > > > > But moving forward to part 1, It says, cd to the directory and run the > > > > command > > > > django-admin.py startproject mysite > > > > > This is where I don't understand. > > > > - running the command from cmd, it says django-admin.py is not > > > > recognized as command. > > > > - if I run python first, it says syntax error. > > > > > Am I missing something from the tutorial? Does the project need to be > > > > in a particular folder in order for the .py file to be executable? Is > > > > there anything else I need to add to windows other than adding C: > > > > \Python27 to PATH? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: need help following tutorial part 1
you should not. are you IN c:\...\scripts when you type in "django-admin.py"? AFAIK windows adds the current directory always to the path. and it's AXEL ;) 2011/1/29 Panupat> Hi Alex. Thank you for you suggestion. > > It seems I can get the script to run if I type out the full path. > > C:\Python27\Scripts\django-admin.py startprofect mysite > > C:\Python27 is already added to my windows' PATH. Proably will need to > add C:\Python27\Scripts to it too. > > > On Jan 30, 1:44 am, Axel Bock wrote: > > hm ... my windows times are over quite a while, BUT ... > > > > 1) try associating the .py extension with the python commandline > > interpreter. > > 2) syntax error? send a screendump maybe, or your exact command line ... > it > > _should_ work without problems. > > > > can you execute other simple python scripts? > > > > cheers, > > axel. > > > > 2011/1/29 Panupat > > > > > I'm kinda stuck and would greatly appreciate any help. > > > > > I followed these turorials and got Django to install. Was able to > > > import Django and print out the version correctly. I'm running > > > Apache2.2 on windows 7 with mod_wsgi > > > > >http://docs.djangoproject.com/en/1.2/intro/install/ > > > > > But moving forward to part 1, It says, cd to the directory and run the > > > command > > > django-admin.py startproject mysite > > > > > This is where I don't understand. > > > - running the command from cmd, it says django-admin.py is not > > > recognized as command. > > > - if I run python first, it says syntax error. > > > > > Am I missing something from the tutorial? Does the project need to be > > > in a particular folder in order for the .py file to be executable? Is > > > there anything else I need to add to windows other than adding C: > > > \Python27 to PATH? > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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: need help following tutorial part 1
Hi Alex. Thank you for you suggestion. It seems I can get the script to run if I type out the full path. C:\Python27\Scripts\django-admin.py startprofect mysite C:\Python27 is already added to my windows' PATH. Proably will need to add C:\Python27\Scripts to it too. On Jan 30, 1:44 am, Axel Bockwrote: > hm ... my windows times are over quite a while, BUT ... > > 1) try associating the .py extension with the python commandline > interpreter. > 2) syntax error? send a screendump maybe, or your exact command line ... it > _should_ work without problems. > > can you execute other simple python scripts? > > cheers, > axel. > > 2011/1/29 Panupat > > > I'm kinda stuck and would greatly appreciate any help. > > > I followed these turorials and got Django to install. Was able to > > import Django and print out the version correctly. I'm running > > Apache2.2 on windows 7 with mod_wsgi > > >http://docs.djangoproject.com/en/1.2/intro/install/ > > > But moving forward to part 1, It says, cd to the directory and run the > > command > > django-admin.py startproject mysite > > > This is where I don't understand. > > - running the command from cmd, it says django-admin.py is not > > recognized as command. > > - if I run python first, it says syntax error. > > > Am I missing something from the tutorial? Does the project need to be > > in a particular folder in order for the .py file to be executable? Is > > there anything else I need to add to windows other than adding C: > > \Python27 to PATH? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: need help following tutorial part 1
hm ... my windows times are over quite a while, BUT ... 1) try associating the .py extension with the python commandline interpreter. 2) syntax error? send a screendump maybe, or your exact command line ... it _should_ work without problems. can you execute other simple python scripts? cheers, axel. 2011/1/29 Panupat> I'm kinda stuck and would greatly appreciate any help. > > I followed these turorials and got Django to install. Was able to > import Django and print out the version correctly. I'm running > Apache2.2 on windows 7 with mod_wsgi > > http://docs.djangoproject.com/en/1.2/intro/install/ > > But moving forward to part 1, It says, cd to the directory and run the > command > django-admin.py startproject mysite > > This is where I don't understand. > - running the command from cmd, it says django-admin.py is not > recognized as command. > - if I run python first, it says syntax error. > > Am I missing something from the tutorial? Does the project need to be > in a particular folder in order for the .py file to be executable? Is > there anything else I need to add to windows other than adding C: > \Python27 to PATH? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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.
need help following tutorial part 1
I'm kinda stuck and would greatly appreciate any help. I followed these turorials and got Django to install. Was able to import Django and print out the version correctly. I'm running Apache2.2 on windows 7 with mod_wsgi http://docs.djangoproject.com/en/1.2/intro/install/ But moving forward to part 1, It says, cd to the directory and run the command django-admin.py startproject mysite This is where I don't understand. - running the command from cmd, it says django-admin.py is not recognized as command. - if I run python first, it says syntax error. Am I missing something from the tutorial? Does the project need to be in a particular folder in order for the .py file to be executable? Is there anything else I need to add to windows other than adding C: \Python27 to PATH? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.
newbie question about paths
Suppose the project is /var/www/django/project. Following the django with wsgi docs, you would add /var/www/django to the path, and DJANGO_SETTINGS_MODULE would be project.settings. However, in that case, the path scheme described in the tutorial doesn't work, e.g. setting up admin.py for Polls as described will throw an error because it can't find a module Polls. Instead you have to "from project.Polls.models import Polls", which seems to break the modularity of the Polls app (since it has the project name embedded in it, now). So, should the wsgi config instead add /var/www/django/project to the path, and set DJANGO_SETTINGS_MODULE to "settings"? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Word file Display and Save??
What's the rationale behind attaching a .doc file to a user profile? I'm willing to bet $20 this isn't the best solution for what you need. Sincerely, André Terra On Sat, Jan 29, 2011 at 10:18, Andy McKaywrote: > > On 2011-01-28, at 8:16 PM, nicolas lubkov wrote: > > Hello all, is there a way to display a word .doc in the user profile and > let the users edit it and save it to keep in their profile.?? > > > You may add what ever you want to a user profile model and you can add > files to models using a FileField. > > http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield > -- > Andy McKay > a...@clearwind.ca > twitter: @andymckay > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@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-users@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: Django cache created in one function not available to another?
This sounds similar to this bug : http://code.djangoproject.com/ticket/15149 On Jan 28, 8:02 am, Lance Vickwrote: > So I have a function that sets cache (and successfully outputs it): > > def push_cache: > cache.set('foo_cache', 'FUBAR!!!') > foodata = cache.get('foo_cache') > print(foodata) # this works > > However when I try to access that cache from within a view and > directly output it it returns None: > > def fetch_cache(request): > cache_data = cache.get('foo_cache') > return HttpResponse(cache_data) #this does not work. > > Am i misunderstanding something fundamental in how cache works? > > I am using the memcached backend in django 1.2.3 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Django Admin - list_display doesn't follow FK links?
On Saturday, January 29, 2011 12:28:49 PM UTC, Victor Hooi wrote: > > Hi, > > I'm trying to use list_display in the django-admin, and I can't seem to > find a way to get list_display to follow FK links. > > My models.py: > > class Site(models.Model): > name = models.CharField(max_length=50, unique=True) > description = models.TextField() > > def __unicode__(self): > return u'%s' % (self.name) > > class AccommodationFeature(models.Model): > name = models.CharField(max_length=50, unique=True) > description = models.TextField() > > class AccommodationRoom(models.Model): > name = models.CharField(max_length=50) > site = models.ForeignKey(Site) > features = models.ManyToManyField(AccommodationFeature, null=True, > blank=True) > > def __unicode__(self): > return u'%s' % (self.name) > > class BedAvailability(models.Model): > number_of_single_beds = models.IntegerField() > number_of_double_beds = models.IntegerField() > conference = models.ForeignKey(Conference) > accommodation_room = models.ForeignKey(AccommodationRoom) > > class Meta: > verbose_name_plural = 'bed availabilities' > > def __unicode__(self): > return u'Availability for %s at %s' % (self.accommodation_room, > self.conference) > # Surely this isredundant? hmm, list_dispaly doesn't seem to follow > foreignkey relationships? > def site_name(self): > return u'%s' % (self.accommodation_room.site.name) > > Each "Site" has multiple "AccommodationRooms", which in turn have > "BedAvailabilities". > > In the BedAvailabilitiesAdmin, for list_display, I'm trying to follow > self.accommodation_room.site. This doesn't work using either dot notation or > double-underscore notation. > > Other ModelAdmin options seem to allow following FK links, using the double > underscore notation. > > E.g. ModelAdmin.search_fields allows you to search across FK's using: > > search_fields = ['foreign_key__related_fieldname'] > > > list_filter also seems to allow the same behaviour. > > At the moment, I'm just using a function on BedAvailabilities to follow the > relationships and print the site name. However, this seems a bit silly when > logic would dictate that list_display behaves the same as search_fields and > list_filter. > > Is there any reason this feature doesn't work for list_display? > > There's some discussion of it on SO: > > > http://stackoverflow.com/questions/163823/can-list-display-in-a-django-modeladmin-display-attributes-of-foreignkey-fields > > And a ticket for it her: > > http://code.djangoproject.com/ticket/5863 > > but discussion seems to have petered off. Is there a technical or design > reason for this? > > Cheers, > Victor > The SO discussion you link to has several answers that give the correct workaround - create a method on the ModelAdmin that returns the value of the followed foreignkey. -- 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-users@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.
Django Admin - list_display doesn't follow FK links?
Hi, I'm trying to use list_display in the django-admin, and I can't seem to find a way to get list_display to follow FK links. My models.py: class Site(models.Model): name = models.CharField(max_length=50, unique=True) description = models.TextField() def __unicode__(self): return u'%s' % (self.name) class AccommodationFeature(models.Model): name = models.CharField(max_length=50, unique=True) description = models.TextField() class AccommodationRoom(models.Model): name = models.CharField(max_length=50) site = models.ForeignKey(Site) features = models.ManyToManyField(AccommodationFeature, null=True, blank=True) def __unicode__(self): return u'%s' % (self.name) class BedAvailability(models.Model): number_of_single_beds = models.IntegerField() number_of_double_beds = models.IntegerField() conference = models.ForeignKey(Conference) accommodation_room = models.ForeignKey(AccommodationRoom) class Meta: verbose_name_plural = 'bed availabilities' def __unicode__(self): return u'Availability for %s at %s' % (self.accommodation_room, self.conference) # Surely this isredundant? hmm, list_dispaly doesn't seem to follow foreignkey relationships? def site_name(self): return u'%s' % (self.accommodation_room.site.name) Each "Site" has multiple "AccommodationRooms", which in turn have "BedAvailabilities". In the BedAvailabilitiesAdmin, for list_display, I'm trying to follow self.accommodation_room.site. This doesn't work using either dot notation or double-underscore notation. Other ModelAdmin options seem to allow following FK links, using the double underscore notation. E.g. ModelAdmin.search_fields allows you to search across FK's using: search_fields = ['foreign_key__related_fieldname'] list_filter also seems to allow the same behaviour. At the moment, I'm just using a function on BedAvailabilities to follow the relationships and print the site name. However, this seems a bit silly when logic would dictate that list_display behaves the same as search_fields and list_filter. Is there any reason this feature doesn't work for list_display? There's some discussion of it on SO: http://stackoverflow.com/questions/163823/can-list-display-in-a-django-modeladmin-display-attributes-of-foreignkey-fields And a ticket for it her: http://code.djangoproject.com/ticket/5863 but discussion seems to have petered off. Is there a technical or design reason for this? Cheers, Victor -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: QUERYDICT immutable
On 2011-01-29, at 5:25 AM, sami nathan wrote: > now i want to change just message in my request.POST (denoted by red color in > above request) and i am helpless i tried the following code > > def recive_ShortMessage(request): > if request.method == 'POST': > request=request.POST.QueryDict.copy() > qt=request.QueryDict.copy() > print qt > qt['message'] = 'I am changing it!' > return HttpResponse(qt) So presumably a) you'll want to parse the soap into some python datastructure then b) alter it and then c) serialise it back out as the new value. So you'll need to find a python SOAP library, suds might do it: https://fedorahosted.org/suds/ Please note that the HttpResponse takes a string, not a dictionary as you are trying to use. Documented here: http://docs.djangoproject.com/en/dev/ref/request-response/#httpresponse-objects -- Andy McKay a...@clearwind.ca twitter: @andymckay -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Word file Display and Save??
On 2011-01-28, at 8:16 PM, nicolas lubkov wrote: > Hello all, is there a way to display a word .doc in the user profile and let > the users edit it and save it to keep in their profile.?? You may add what ever you want to a user profile model and you can add files to models using a FileField. http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield -- Andy McKay a...@clearwind.ca twitter: @andymckay -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Word file Display and Save??
I am not so sure if you can access MS word from python directly, or if there are some libraries that allow you to do so. But I am sure that there is one thing you can try: WORD -> XML -> DOM -> Python -> django views.py / admin_views.py -> DOM -> XML -> WORD hope this helps, correct me if this is nonsense Thanks, Maxim Mai On Jan 28, 3:16 pm, nicolas lubkovwrote: > Hello all, is there a way to display a word .doc in the user profile and let > the users edit it and save it to keep in their profile.?? > > -- > Saludos. > > Nicolas Lubkov > Ing. Informatica de gestion -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.