Re: cannot connect to postgresql database
Page not found (404) Request Method: GET Request URL:http://127.0.0.1:8000/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: 1. ^hello/$ The current URL, , didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. is the error when i try the samples from djangobook.com TANYA -- 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: Large Queryset Calculation In Background?
On Wed, Nov 23, 2011 at 8:09 PM, Nikolas Stevenson-Molnar wrote: > What database are you using? You should be able to find information in > the documents about the locking behavior for that database. Compare that > with the operations your running and determine whether they would result > in an exclusive lock. > > From your pseudocode, it looks like you're performing a possibly-lengthy > select, followed by lengthy calculations (not involving database > operations), and then a (presumably) quick save. AFAIK, databases never > lock when doing selects, so depending on the nature of your > calculations, you should be fine. > MySQL will always lock tables for writes when reading from them. Therefore, any long running query on a mysql table will result in updates to that table being locked out. The easiest way around this is with hardware. Use a master-slave DB setup, and perform your long reads on the slave(s), and all your writes on the master. Cheers Tom -- 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: cannot connect to postgresql database
On Thursday, 24 November 2011 09:39:58 UTC, Tanya wrote: > > Page not found (404) > Request Method: GET > Request URL: http://127.0.0.1:8000/ > > Using the URLconf defined in mysite.urls, Django tried these URL > patterns, in this order: > >1. ^hello/$ > > The current URL, , didn't match any of these. > > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a > standard 404 page. > > is the error when i try the samples from djangobook.com > > TANYA > What in that message could possibly lead you to the conclusion that you can't connect to Postgres? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/4E6gZUEbVfkJ. 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: cannot connect to postgresql database
Hi Tanya Okay 404 is a page not found error. According to your problem what i can say is when there is something wrong in the urls.py file. Check it carefully. Explanation :- When you type in the url (which should be present in the urls.py file) it match to a praticular function in views. I can't see here .Also please specify a little bit code and tell what exactly you type in urls(address bar) On Thu, Nov 24, 2011 at 3:09 PM, TANYA wrote: > Page not found (404) > Request Method: GET > Request URL:http://127.0.0.1:8000/ > > Using the URLconf defined in mysite.urls, Django tried these URL > patterns, in this order: > > 1. ^hello/$ > > The current URL, , didn't match any of these. > > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a > standard 404 page. > > is the error when i try the samples from djangobook.com > > TANYA > > -- > 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. > > -- Regards Nikhil Verma +91-958-273-3156 -- 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: aggregate(Sum('x')) returns None
None != 0 If no rows were encountered, then None should be returned, because there was no data to aggregate, thus how can it logically come back with 0? I'm -1 on this On Wed, Nov 23, 2011 at 6:24 PM, M. Can Bayrak wrote: > Agree, i think sum must return decimal. Same problem with me. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/tS-EZk6nTbEJ. > 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: cannot connect to postgresql database
ok, I didnt know. I trry http://127.0.0.1:8000/hello/ and it works. Thankyou. -- TANYA -- 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: cannot connect to postgresql database
I keep seeing this message, KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-tani/ksycoca4" On Thu, Nov 24, 2011 at 9:49 AM, Daniel Roseman wrote: > On Thursday, 24 November 2011 09:39:58 UTC, Tanya wrote: >> >> Page not found (404) >> Request Method: GET >> Request URL: http://127.0.0.1:8000/ >> >> Using the URLconf defined in mysite.urls, Django tried these URL >> patterns, in this order: >> >> 1. ^hello/$ >> >> The current URL, , didn't match any of these. >> >> You're seeing this error because you have DEBUG = True in your Django >> settings file. Change that to False, and Django will display a >> standard 404 page. >> >> is the error when i try the samples from djangobook.com >> >> TANYA > > What in that message could possibly lead you to the conclusion that you > can't connect to Postgres? > -- > DR. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/4E6gZUEbVfkJ. > 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. > -- CHEERS, TANYA -- 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: Editable datagrid
Hi Vikas, I have successfully used jqgrid. It's very customizable and you have inline editing and form editing. Best regards, Gabriel On 21 nov., 13:46, Vikas Rawal wrote: > I am new to django and to web programming. I am trying to build a > database application for entering/querying/viewing data from a mysql > database. The data entry module needs to have datagrids where users > can enter multiple rows of data belonging to a particular set. > > Would be grateful for pointers to resources on the best way to > implement datagrids in django. > > Vikas -- 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: cannot connect to postgresql database
No Problem dear It happens.!! On Thu, Nov 24, 2011 at 4:38 PM, TANYA wrote: > I keep seeing this message, KSycocaPrivate::openDatabase: Trying to > open ksycoca from "/var/tmp/kdecache-tani/ksycoca4" > > > On Thu, Nov 24, 2011 at 9:49 AM, Daniel Roseman > wrote: > > On Thursday, 24 November 2011 09:39:58 UTC, Tanya wrote: > >> > >> Page not found (404) > >> Request Method: GET > >> Request URL: http://127.0.0.1:8000/ > >> > >> Using the URLconf defined in mysite.urls, Django tried these URL > >> patterns, in this order: > >> > >>1. ^hello/$ > >> > >> The current URL, , didn't match any of these. > >> > >> You're seeing this error because you have DEBUG = True in your Django > >> settings file. Change that to False, and Django will display a > >> standard 404 page. > >> > >> is the error when i try the samples from djangobook.com > >> > >> TANYA > > > > What in that message could possibly lead you to the conclusion that you > > can't connect to Postgres? > > -- > > DR. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/django-users/-/4E6gZUEbVfkJ. > > 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. > > > > > > -- > CHEERS, TANYA > > -- > 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. > > -- Regards Nikhil Verma +91-958-273-3156 -- 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: Named URLs Error
Not sure but I think you have to put {% load tags %} in your template. On Nov 24, 2011, at 6:07 , eeyore wrote: > This seems like a very simple problem but I can't figure out why it > doesn't work. > > What I am trying to do is to link to a particular view via a named > url. > > > /urls.py > -- > urlpatterns = patterns('', >(r'^products/', include('products.urls')), > ) > > /products/urls.py > -- > from django.conf.urls.defaults import patterns, url > > urlpatterns = patterns('products.views', >url(r'^$', view="index", name="products_index"), > ) > > /templates/products/index.html > -- > Products > > Error > -- > In template /home/user/app/templates/inc/header.html, error at line 18 > Caught ImportError while rendering: No module named urls > > -- > 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: Named URLs Error
forget my previous post, it is wrong. > /templates/products/index.html > -- > Products > > Error > -- > In template /home/user/app/templates/inc/header.html, error at line 18 > Caught ImportError while rendering: No module named urls see that there are different templates. can you show what is happening in: template /home/user/app/templates/inc/header.html, error at line 18 -- 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: Import error when unit testing with django.test.client on django 1.1.1
Thanks Xavier I will research this better but the path for the settings file is wrong in this error, it should be 'bo.settings' not 'DER.settings' but that might be because the tests do not have my project in their path Thanks again Erlendur -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/sYOZNTnBLCIJ. 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 : CSRF and variable handling in a view
DrBloodMoney is right, It is kind of odd how you are solving the problem but it might me kind of right depending on what you are trying to do. Considering how most of the websites work you should do this. In all the templates include another template which does this: {% if not user.is_authenticated %} LINK Login | Link Sign Up {% else %} Logged in as username | Link Logout {% endif %} Logout, Login and Sign Up are handled by different urls/views and not the index or any other view if you want to make a view available only to authenticated users, use the @login_required decorator.[2] If you are using the provided django.auth system the views for login, logout are already there. In the settings you can define some behavior. See the settings LOGIN_REDIRECT_URL, LOGIN_URL, LOGOUT_URL [1] [1] https://docs.djangoproject.com/en/1.3/ref/settings/#login-url [2] https://docs.djangoproject.com/en/1.3/topics/auth/#the-login-required-decorator On Nov 24, 2011, at 3:31 , Nolhian wrote: >> This seems all sorts of wrong to me. Why couldn't the user just log >> out and then post? Seems like an odd workflow, but I don't know your >> business-case here. > > Yes the user can just log out and then post but since this is a sign- > up form it would seem logical to not be able to sign-up if the user is > logged in which means he already has an account. > >> You could always control what is shown to the user in the template (to >> limit their ability to use your form to post to the view) with >> >> {% if not user.is_authenticated %} >> SHOW FORM >> {% else %} >> you're logged in so you can't post >> {% endif %} > > That's kind of what I'm doing but I still need to check somewhere in > the view if the user is logged in. If I don't the user can open the > sign-up form page, then open another page of the site and log in, then > switch back to the sign-up form page, send the form ( which will be > validated in the view since there's no checking if the user is > authenticated or not there ) and successfully sign-up again WHILE > being logged in. To be able to do that just seems wrong to 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-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: Named URLs Error
On Thu, Nov 24, 2011 at 5:07 AM, eeyore wrote: > This seems like a very simple problem but I can't figure out why it > doesn't work. > > What I am trying to do is to link to a particular view via a named > url. > > > Error > -- > In template /home/user/app/templates/inc/header.html, error at line 18 > Caught ImportError while rendering: No module named urls > Ivo: I don't think it is relevant what is in the template. This error says that it could not import a module named urls. Since in your root urlconf you tell it to load 'product.urls', I would imagine the problem is that Django cannot import the 'urls' module from 'product'. I can think of a couple of possible issues (there may be others!): 1) The 'product' directory is not a module itself - it has no __init__.py 2) You have two modules called 'product', and it is attempting to import urls from the 'wrong one'. Is it one of those errors, or do we need to keep digging? What happens if you load up a django shell (python manage.py shell) and import product.urls directly there ("from product.urls import urlpatterns"). What error does that show? Cheers Tom -- 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 : CSRF and variable handling in a view
Hello, First of all thanks for your answer ! I think that the name I gave "index.html" is causing confusion. In fact that's the first view I created and so the only template I have at the moment and I awkwardly named it index.html, It should be named signup.html or something like that. I'm not looking to handle log in and logout here, just making sure that a logged user cannot sign-up again ( which would be a nonsense and in my opinion a flaw ),this is my signup form view which is located at /subscribe/. Is it better with these explications or does the approach I'm taking still feel weird ? Nolhian On Nov 24, 1:37 pm, Ivo Brodien wrote: > DrBloodMoney is right, It is kind of odd how you are solving the problem but > it might me kind of right depending on what you are trying to do. > > Considering how most of the websites work you should do this. > > In all the templates include another template which does this: > > {% if not user.is_authenticated %} > LINK Login | Link Sign Up > {% else %} > Logged in as username | Link Logout > {% endif %} > > Logout, Login and Sign Up are handled by different urls/views and not the > index or any other view > > if you want to make a view available only to authenticated users, use the > @login_required decorator.[2] > > If you are using the provided django.auth system the views for login, logout > are already there. In the settings you can define some behavior. > > See the settings LOGIN_REDIRECT_URL, LOGIN_URL, LOGOUT_URL [1] > > [1]https://docs.djangoproject.com/en/1.3/ref/settings/#login-url > [2]https://docs.djangoproject.com/en/1.3/topics/auth/#the-login-required... > > On Nov 24, 2011, at 3:31 , Nolhian wrote: > > > > > > > > >> This seems all sorts of wrong to me. Why couldn't the user just log > >> out and then post? Seems like an odd workflow, but I don't know your > >> business-case here. > > > Yes the user can just log out and then post but since this is a sign- > > up form it would seem logical to not be able to sign-up if the user is > > logged in which means he already has an account. > > >> You could always control what is shown to the user in the template (to > >> limit their ability to use your form to post to the view) with > > >> {% if not user.is_authenticated %} > >> SHOW FORM > >> {% else %} > >> you're logged in so you can't post > >> {% endif %} > > > That's kind of what I'm doing but I still need to check somewhere in > > the view if the user is logged in. If I don't the user can open the > > sign-up form page, then open another page of the site and log in, then > > switch back to the sign-up form page, send the form ( which will be > > validated in the view since there's no checking if the user is > > authenticated or not there ) and successfully sign-up again WHILE > > being logged in. To be able to do that just seems wrong to 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-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://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: Editable datagrid
On Thu, Nov 24, 2011 at 6:28 AM, Gabriel - Iulian Dumbrava wrote: > I have successfully used jqgrid. It's very customizable and you have > inline editing and form editing. same here. slicktables looks very good too, but documentation is lacking, so i haven't really tried it yet -- Javier -- 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.
Using DSE when a model contains a manytomany field
Hi everybody. I want to insert data into my Django db as I read from a CSV file. Everything was fine with a first model of mine. ## fields = ("name", "price") for (counter, row) in enumerate(csvReader): product_dict = dict(zip(fields, row)) Product.delayed.insert(product_dict) Product.delayed.flush() ## Now I am dealing with another model which contains a manytomany field. Can I use DSE now? Which syntax am I supposed to use? Kind regards, Fabio. -- Fabio Natali -- 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 : CSRF and variable handling in a view
Hi! Ah, ok. Now it makes a more sense - index was indeed confusing. Well in your template I would just make the check and show the form or not. If your don’t show the form, the user cannot make a POST to the signup view since he does not have a valid CSRF token. Anyway, if the user is logged in there should not be a Link to the signup page and even if he enters the signup form url by hand, he will see no form. Ah, and don’t worry about the RequestContext. I don’t think that it causes any important amount of overhead. The processing was done anyways before, so its just a matter of making it available to the template or not. And you will see, that you will use it often in your templates. Ivo On Nov 24, 2011, at 14:25 , Nolhian wrote > Hello, > > First of all thanks for your answer ! > I think that the name I gave "index.html" is causing confusion. In > fact that's the first view I created and so the only template I have > at the moment and I awkwardly named it index.html, It should be named > signup.html or something like that. I'm not looking to handle log in > and logout here, just making sure that a logged user cannot sign-up > again ( which would be a nonsense and in my opinion a flaw ),this is > my signup form view which is located at /subscribe/. > > Is it better with these explications or does the approach I'm taking > still feel weird ? > > Nolhian > > On Nov 24, 1:37 pm, Ivo Brodien wrote: >> DrBloodMoney is right, It is kind of odd how you are solving the problem but >> it might me kind of right depending on what you are trying to do. >> >> Considering how most of the websites work you should do this. >> >> In all the templates include another template which does this: >> >> {% if not user.is_authenticated %} >> LINK Login | Link Sign Up >> {% else %} >> Logged in as username | Link Logout >> {% endif %} >> >> Logout, Login and Sign Up are handled by different urls/views and not the >> index or any other view >> >> if you want to make a view available only to authenticated users, use the >> @login_required decorator.[2] >> >> If you are using the provided django.auth system the views for login, logout >> are already there. In the settings you can define some behavior. >> >> See the settings LOGIN_REDIRECT_URL, LOGIN_URL, LOGOUT_URL [1] >> >> [1]https://docs.djangoproject.com/en/1.3/ref/settings/#login-url >> [2]https://docs.djangoproject.com/en/1.3/topics/auth/#the-login-required... >> >> On Nov 24, 2011, at 3:31 , Nolhian wrote: >> >> >> >> >> >> >> This seems all sorts of wrong to me. Why couldn't the user just log out and then post? Seems like an odd workflow, but I don't know your business-case here. >> >>> Yes the user can just log out and then post but since this is a sign- >>> up form it would seem logical to not be able to sign-up if the user is >>> logged in which means he already has an account. >> You could always control what is shown to the user in the template (to limit their ability to use your form to post to the view) with >> {% if not user.is_authenticated %} SHOW FORM {% else %} you're logged in so you can't post {% endif %} >> >>> That's kind of what I'm doing but I still need to check somewhere in >>> the view if the user is logged in. If I don't the user can open the >>> sign-up form page, then open another page of the site and log in, then >>> switch back to the sign-up form page, send the form ( which will be >>> validated in the view since there's no checking if the user is >>> authenticated or not there ) and successfully sign-up again WHILE >>> being logged in. To be able to do that just seems wrong to 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-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> django-users+unsubscr...@googlegroups.com. >>> For more options, visit this group >>> athttp://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.
com_error
Good day everyone, I am trying to create/edit and close an excel file. Everything went fine on my developpement machine. But on the prod server I get the* following error* : com_error at /mycontracts/getContactClient/ (-2147221005, 'Invalid class string', None, None) *and this trace back* Environment: Request Method: GET Request URL: http://myserveraddress/contractManager/mycontracts/getContactClient/ Django Version: 1.3 Python Version: 2.7.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'mycontracts', 'django.contrib.admindocs'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.csrf.CsrfResponseMiddleware') Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "C:\Python27\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view 23. return view_func(request, *args, **kwargs) File "C:\APP\contractManager\mycontracts\views.py" in getContactClient 759. myresultForExcelFile = createMatriceContactClientExcelFileNotFromRequest(clients) File "C:\APP\contractManager\mycontracts\views.py" in createMatriceContactClientExcelFileNotFromRequest 1016. excel = Dispatch('Excel.Application') File "C:\Python27\lib\site-packages\win32com\client\__init__.py" in Dispatch 95. dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python27\lib\site-packages\win32com\client\dynamic.py" in _GetGoodDispatchAndUserName 108. return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python27\lib\site-packages\win32com\client\dynamic.py" in _GetGoodDispatch 85.IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) Exception Type: com_error at /mycontracts/getContactClient/ Exception Value: (-2147221005, 'Invalid class string', None, None) Can you please help me see what is wrong. It's the same code on my machine and on the server. Regards, V.B. -- 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 : CSRF and variable handling in a view
I guess I'll surrender and go with only the template authenticated check solution even if it still disturb me a little that the user can display the sign-up form in a page, then log in on another page and still be able to sign-up by sending the form. That's nice to know about the RequestContext ! Also I saw that the render shortcut was born with Django 1.3, that's really a cool addition. Thanks again ;) Nolhian On Nov 24, 3:23 pm, Ivo Brodien wrote: > Hi! > > Ah, ok. Now it makes a more sense - index was indeed confusing. > > Well in your template I would just make the check and show the form or not. > > If your don’t show the form, the user cannot make a POST to the signup view > since he does not have a valid CSRF token. > > Anyway, if the user is logged in there should not be a Link to the signup > page and even if he enters the signup form url by hand, he will see no form. > > Ah, and don’t worry about the RequestContext. I don’t think that it causes > any important amount of overhead. The processing was done anyways before, so > its just a matter of making it available to the template or not. And you will > see, that you will use it often in your templates. > > Ivo > On Nov 24, 2011, at 14:25 , Nolhian wrote > > > > > > > > > Hello, > > > First of all thanks for your answer ! > > I think that the name I gave "index.html" is causing confusion. In > > fact that's the first view I created and so the only template I have > > at the moment and I awkwardly named it index.html, It should be named > > signup.html or something like that. I'm not looking to handle log in > > and logout here, just making sure that a logged user cannot sign-up > > again ( which would be a nonsense and in my opinion a flaw ),this is > > my signup form view which is located at /subscribe/. > > > Is it better with these explications or does the approach I'm taking > > still feel weird ? > > > Nolhian > > > On Nov 24, 1:37 pm, Ivo Brodien wrote: > >> DrBloodMoney is right, It is kind of odd how you are solving the problem > >> but it might me kind of right depending on what you are trying to do. > > >> Considering how most of the websites work you should do this. > > >> In all the templates include another template which does this: > > >> {% if not user.is_authenticated %} > >> LINK Login | Link Sign Up > >> {% else %} > >> Logged in as username | Link Logout > >> {% endif %} > > >> Logout, Login and Sign Up are handled by different urls/views and not the > >> index or any other view > > >> if you want to make a view available only to authenticated users, use the > >> @login_required decorator.[2] > > >> If you are using the provided django.auth system the views for login, > >> logout are already there. In the settings you can define some behavior. > > >> See the settings LOGIN_REDIRECT_URL, LOGIN_URL, LOGOUT_URL [1] > > >> [1]https://docs.djangoproject.com/en/1.3/ref/settings/#login-url > >> [2]https://docs.djangoproject.com/en/1.3/topics/auth/#the-login-required... > > >> On Nov 24, 2011, at 3:31 , Nolhian wrote: > > This seems all sorts of wrong to me. Why couldn't the user just log > out and then post? Seems like an odd workflow, but I don't know your > business-case here. > > >>> Yes the user can just log out and then post but since this is a sign- > >>> up form it would seem logical to not be able to sign-up if the user is > >>> logged in which means he already has an account. > > You could always control what is shown to the user in the template (to > limit their ability to use your form to post to the view) with > > {% if not user.is_authenticated %} > SHOW FORM > {% else %} > you're logged in so you can't post > {% endif %} > > >>> That's kind of what I'm doing but I still need to check somewhere in > >>> the view if the user is logged in. If I don't the user can open the > >>> sign-up form page, then open another page of the site and log in, then > >>> switch back to the sign-up form page, send the form ( which will be > >>> validated in the view since there's no checking if the user is > >>> authenticated or not there ) and successfully sign-up again WHILE > >>> being logged in. To be able to do that just seems wrong to 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-users@googlegroups.com. > >>> To unsubscribe from this group, send email to > >>> django-users+unsubscr...@googlegroups.com. > >>> For more options, visit this group > >>> athttp://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 > > athttp://groups.google.c
Installation of Django
Hello, I am new to Django! I was able to download and install: Python 2.7.2 x86 64 on my Windows 7 64 bit machine. I think that is all that I will need to execute the command line? I installed Python to C:/Python27 as the program intended. I then downloaded: Django-1.3.1.tar.gz file and was try to figure where to go to next. I used the 7 zip to extract it to: Django-1.3.1.tar. But I wasn't sure the next steps. I opened the Python cmd prompt. I typed the command in: tar xzvf Django-*.tar.gz. But I got errors about the portion "xzvf" I feel that the directories are not set up correctly. Do I need to adjust my command for the directory because I already tried that. I would really appreciate a step through that would get me all set up with the baseline. I am interested to moving on from to the more in depth chapters. I tried hard to understand the input from the comments on the page but I was unable to find anything that gave me any sense of direction on how to place the Django files. Thanks! JJ PS. sorry this is available and I didn't see it in the new booklet. -- 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.
Help with many-to-many field update
Hi, I am relatively new to Django, and am trying to update a many-to-many related table using a ModelForm. I see fro the documentation that if I use save(commit=False) - which I do - I need to use save_m2m() after saving the initial form. I am using the save_m2m(), but my related table does not get updated. Any help appreciated. I am using django V1.3.1 on linux using Postgresql as the db. Details: The Model: class srvorders(models.Model): client = models.CharField('Client', max_length=200) server = models.CharField('Server Type', max_length=200) os = models.CharField('Operating System', max_length=200) osopts = models.CharField('Operating System Options', max_length=200, blank=True, null=True) ordertotal = models.IntegerField() notes = models.TextField('Notes', blank=True, null=True) orderdate = models.DateTimeField() orderIP = models.IPAddressField() status = models.CharField('Order Status', max_length="20") srvopts = models.ManyToManyField(srvoptions, blank=True, null=True) class Meta: ordering = ["id"] verbose_name_plural = "Server Orders" def __unicode__(self): return str(self.id) class Admin: pass The ModelForm: class NewOrderForm(forms.ModelForm): Server_CHOICES = [('', '-- choose a Server --'), ] + [(s.id, s.name) for s in products.objects.all()] OS_CHOICES = [('', '-- choose a Server --'), ] +[(o.id, o.name) for o in OS.objects.all()] OPTION_CHOICES = [('', '-- choose a Server --'), ] +[(opt.id, opt.name) for opt in osoptions.objects.all()] server=forms.ChoiceField(choices=Server_CHOICES) os = forms.ChoiceField(choices=OS_CHOICES) osopts=forms.ChoiceField(choices=OPTION_CHOICES, required=False) ordertotal=forms.CharField(required=False) notes=forms.CharField(required=False) class Meta: model= srvorders exclude = ('client', 'orderdate', 'orderIP', 'status') The View snippet: if request.method == 'POST': form = NewOrderForm(request.POST) if form.is_valid(): new_item = form.save(commit=False) new_item.client = orderClient new_item.orderdate = datetime.now() new_item.orderIP = remote_ip new_item.status = "Not_Paid" new_item.save() form.save_m2m() Regards, Leslie -- 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.
Loading django templates/static files from pyrcc4 generated resource file
Hi folks, I am writing a PyQt frontend to a django application. Before calling app.exec_() on the qt app i first start up the django development server on a thread and later on access my views through a QtWebView. Since I use the pyrcc4 generated resource file for my qt app I just think it would be a lot cooler if I could do the same with my templates/static files in the django app. Is this possible? Which template loaders will allow me use this approach? Thanks in advance! Abraham. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/xgxKLfOT2l0J. 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.
Seeking example of django.contrib.staticfiles usage
I'm evaluating frameworks, writing the same app different ways. I've run smack into Django's static file handling. I understand that with Django my basic options for static files are: 1) Static files on a separate web server 2) Configure apache to send some content to Django, serve some statically. 3) Have django.contrib.staticfiles to serve static content (perhaps non-optimally) from the Django runtime. Is there a simple example of #3 (the only one that lets me package up a complete "app")? I've read: https://docs.djangoproject.com/en/dev/howto/static-files/ And trolled the forums. Both make it seem much more complicated than it probably actually is. There's a lot of cruft in the document. And when I add "django.contrib.staticfiles" the runtime simply reports "Error: No module named staticfiles". Is there a good working tested example out there? # django-admin.py --version 1.2.5 -- 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.
getting errors in http://www.ftdichip.com/Drivers/D2XX/D2XXSample/D2XXSample.zip on android 2.3.3
Hi I am getting the below errors for the code which i have attched in the below link, am not able to resolve the it when i was debugging in the android sdk could ne body pls help me code link: http://www.ftdichip.com/Drivers/D2XX/D2XXSample/D2XXSample.zip Errors: 11-24 10:40:54.462: ERROR/AndroidRuntime(330): at com.ftdi.d2xx.D2XXSampleActivity.onCreate(D2XXSampleActivity.java:38) 11-24 10:40:54.462: ERROR/AndroidRuntime(330): at com.ftdi.D2xx.(D2xx.java:28) D2xx.setVIDPID(0x0403, 0xada1); System.load("/data/data/com.ftdi.d2xx/libftd2xx-jni.so"); -- 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: getting errors in http://www.ftdichip.com/Drivers/D2XX/D2XXSample/D2XXSample.zip on android 2.3.3
Django != Android. Stop posting Android questions on this list please. -- 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: com_error
I forgot to mention that Microsoft office is not install on the server. Is it a problem? Regard, V.B. On 24 nov, 09:58, Phanounou wrote: > Good day everyone, > > I am trying to create/edit and close an excel file. Everything went fine on > my developpement machine. But on the prod server I get the* following error* > : > > com_error at /mycontracts/getContactClient/ > (-2147221005, 'Invalid class string', None, None) > > *and this trace back* > > Environment: > > Request Method: GET > Request > URL:http://myserveraddress/contractManager/mycontracts/getContactClient/ > Django Version: 1.3 > Python Version: 2.7.2 > Installed Applications: > ['django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.messages', > 'django.contrib.staticfiles', > 'django.contrib.admin', > 'mycontracts', > 'django.contrib.admindocs'] > Installed Middleware: > ('django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > 'django.middleware.csrf.CsrfResponseMiddleware') > > Traceback: > File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in > get_response > 111. response = callback(request, *callback_args, > **callback_kwargs) > File "C:\Python27\lib\site-packages\django\contrib\auth\decorators.py" in > _wrapped_view > 23. return view_func(request, *args, **kwargs) > File "C:\APP\contractManager\mycontracts\views.py" in getContactClient > 759. myresultForExcelFile = > createMatriceContactClientExcelFileNotFromRequest(clients) > File "C:\APP\contractManager\mycontracts\views.py" in > createMatriceContactClientExcelFileNotFromRequest > 1016. excel = Dispatch('Excel.Application') > File "C:\Python27\lib\site-packages\win32com\client\__init__.py" in Dispatch > 95. dispatch, userName = > dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > File "C:\Python27\lib\site-packages\win32com\client\dynamic.py" in > _GetGoodDispatchAndUserName > 108. return (_GetGoodDispatch(IDispatch, clsctx), userName) > File "C:\Python27\lib\site-packages\win32com\client\dynamic.py" in > _GetGoodDispatch > 85. IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > pythoncom.IID_IDispatch) > Exception Type: com_error at /mycontracts/getContactClient/ > Exception Value: (-2147221005, 'Invalid class string', None, None) > > Can you please help me see what is wrong. It's the same code on my machine > and on the server. > > Regards, > V.B. -- 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: Seeking example of django.contrib.staticfiles usage
> 3) Have django.contrib.staticfiles to serve static content (perhaps > non-optimally) from the Django runtime. this is just for developing purposes. 1) 2) are the ways to go. > Is there a simple example of #3 (the only one that lets me package up > a complete "app")? > > I've read: > https://docs.djangoproject.com/en/dev/howto/static-files/ that is the development version https://docs.djangoproject.com/en/1.2/howto/static-files/ > And > when I add "django.contrib.staticfiles" the runtime simply reports > "Error: No module named staticfiles”. that is because django.contrib.staticfiles is there since 1.3 > Is there a good working tested example out there? > > # django-admin.py --version > 1.2.5 switch to 1.3.1 and then you can use django.contrib.staticfiles. Ivo -- 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.
google always finds development version first
Hi, although I know i should bookmark things, but often I find myself googling for some django docs and google always shows the development version. Wouldn’t it be more useful, if the docs of the latest release would be shown first? I understand it might be googles algorithms of showing the newest pages but I am sure something can be done about it. Cheers ivo -- 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: Installation of Django
On Thu, Nov 24, 2011 at 5:00 AM, JJ Zolper wrote: > Hello, > > I am new to Django! I was able to download and install: Python 2.7.2 > x86 64 on my Windows 7 64 bit machine. I think that is all that I will > need to execute the command line? > > I installed Python to C:/Python27 as the program intended. > > I then downloaded: Django-1.3.1.tar.gz file and was try to figure > where to go to next. I used the 7 zip to extract it to: > Django-1.3.1.tar. But I wasn't sure the next steps. I opened the > Python cmd prompt. I typed the command in: tar xzvf Django-*.tar.gz. > But I got errors about the portion "xzvf" I feel that the directories > are not set up correctly. Do I need to adjust my command for the > directory because I already tried that. > > I would really appreciate a step through that would get me all set up > with the baseline. I am interested to moving on from to the more in > depth chapters. I tried hard to understand the input from the comments > on the page but I was unable to find anything that gave me any sense > of direction on how to place the Django files. > > Thanks! > > JJ > > PS. sorry this is available and I didn't see it in the new booklet. > tar.gz is a gzipped (.gz) tape archive (.tar) file. 7zip should be able to gunzip it and extract the files from the archive - it might require two steps. The 'tar xzvf…' command is how one extracts a tar.gz under unix/linux from the OS command line - not the python command line. As the docs say, you can download and install bsdtar in windows, in which case the OS command would be 'bsdtar zxvf …'. This is the second time this week someone has had issues extracting a tgz on windows - any chance that django could be packaged up in a more Windows friendly zip file format in addition to tgz? Cheers Tom https://docs.djangoproject.com/en/1.3/topics/install/#installing-an-official-release -- 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: Named URLs Error
Tom, 1) The 'product' directory is not a module itself - it has no __init__.py The 'product' directory has __init.__.py 2) You have two modules called 'product', and it is attempting to import urls from the 'wrong one'. I created a new app with only one module to test it. "from product.urls import urlpatterns" Returns no errors. Matt On Nov 24, 7:46 am, Tom Evans wrote: > On Thu, Nov 24, 2011 at 5:07 AM, eeyore wrote: > > This seems like a very simple problem but I can't figure out why it > > doesn't work. > > > What I am trying to do is to link to a particular view via a named > > url. > > > > > Error > > -- > > In template /home/user/app/templates/inc/header.html, error at line 18 > > Caught ImportError while rendering: No module named urls > > Ivo: I don't think it is relevant what is in the template. > > This error says that it could not import a module named urls. Since in > your root urlconf you tell it to load 'product.urls', I would imagine > the problem is that Django cannot import the 'urls' module from > 'product'. I can think of a couple of possible issues (there may be > others!): > > 1) The 'product' directory is not a module itself - it has no __init__.py > 2) You have two modules called 'product', and it is attempting to > import urls from the 'wrong one'. > > Is it one of those errors, or do we need to keep digging? What happens > if you load up a django shell (python manage.py shell) and import > product.urls directly there ("from product.urls import urlpatterns"). > What error does that show? > > Cheers > > Tom -- 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 always finds development version first
People behind Django have no control over that. So your question (no offense) makes little sense here. :) -- 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: Using DSE when a model contains a manytomany field
On 11/24/2011 03:17 PM, Fabio Natali wrote: Hi everybody. I want to insert data into my Django db as I read from a CSV file. Everything was fine with a first model of mine. ## fields = ("name", "price") for (counter, row) in enumerate(csvReader): product_dict = dict(zip(fields, row)) Product.delayed.insert(product_dict) Product.delayed.flush() ## Now I am dealing with another model which contains a manytomany field. Can I use DSE now? Which syntax am I supposed to use? Kind regards, Fabio. I'm thinking to leave DSE and try this: https://docs.djangoproject.com/en/dev/topics/db/transactions/#controlling-transaction-management-in-views Tips or ideas are welcome. -- Fabio Natali -- 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: Installation of Django
If you install the "setuptools" package (http://goo.gl/UjFh), then all you have to do to install Django (or any other Python library) is this: easy_install django And it will handle the rest. Just a suggestion. -- Joey "JoeLinux" Espinosa Software Developer http://about.me/joelinux On Nov 24, 2011 10:37 AM, "Tom Evans" wrote: > On Thu, Nov 24, 2011 at 5:00 AM, JJ Zolper wrote: > > Hello, > > > > I am new to Django! I was able to download and install: Python 2.7.2 > > x86 64 on my Windows 7 64 bit machine. I think that is all that I will > > need to execute the command line? > > > > I installed Python to C:/Python27 as the program intended. > > > > I then downloaded: Django-1.3.1.tar.gz file and was try to figure > > where to go to next. I used the 7 zip to extract it to: > > Django-1.3.1.tar. But I wasn't sure the next steps. I opened the > > Python cmd prompt. I typed the command in: tar xzvf Django-*.tar.gz. > > But I got errors about the portion "xzvf" I feel that the directories > > are not set up correctly. Do I need to adjust my command for the > > directory because I already tried that. > > > > I would really appreciate a step through that would get me all set up > > with the baseline. I am interested to moving on from to the more in > > depth chapters. I tried hard to understand the input from the comments > > on the page but I was unable to find anything that gave me any sense > > of direction on how to place the Django files. > > > > Thanks! > > > > JJ > > > > PS. sorry this is available and I didn't see it in the new booklet. > > > > tar.gz is a gzipped (.gz) tape archive (.tar) file. 7zip should be > able to gunzip it and extract the files from the archive - it might > require two steps. > > The 'tar xzvf…' command is how one extracts a tar.gz under unix/linux > from the OS command line - not the python command line. As the docs > say, you can download and install bsdtar in windows, in which case the > OS command would be 'bsdtar zxvf …'. > > This is the second time this week someone has had issues extracting a > tgz on windows - any chance that django could be packaged up in a more > Windows friendly zip file format in addition to tgz? > > Cheers > > Tom > > > https://docs.djangoproject.com/en/1.3/topics/install/#installing-an-official-release > > -- > 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.
converting to a template
I have a python script in which I am building up an html page, and then making a call to HttpResponse(html) to show the page. Now I want to start to using templates, but this is not as easy as I hoped because my html contains a table with a lot of information, and I don't know how to make function calls from the template. Are there any clear examples of how to dynamically create a table from within a template? Many thanks Mark -- 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: Named URLs Error
On Thu, Nov 24, 2011 at 3:43 PM, eeyore wrote: > Tom, > > 1) The 'product' directory is not a module itself - it has no > __init__.py > > The 'product' directory has __init.__.py > > 2) You have two modules called 'product', and it is attempting to > import urls from the 'wrong one'. > > I created a new app with only one module to test it. > > "from product.urls import urlpatterns" > > Returns no errors. > Confused, how does creating a new app and importing urls.py from that test the validity of the urls.py in your current app? I got the name of your app wrong in my initial mail, I see it is actually 'products'. Without starting a new app(!), can you import from 'products.urls' successfully? The traceback clearly indicates that it cannot import a url conf because of import errors. You need to track down what that error is. If you still can't, paste the entire traceback so that we have more information to go on. Cheers Tom -- 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: Installation of Django
Tom, 7zip works great. I am able to unzip the .tgz file and I have my .tar file. Now it is on to installation of it. Okay I have worked with UNIX before so I have some knowledge. I am studying to be a Computer Engineer at VT and have had some experience. My intuition tells me that if I even wanted to work from the command line I would need to adjust the: tar xzvfin windows because I would have already unzipped it. As for the documentation would bsdtar extract and execute? I have no issues extracting I just feel that with little knowledge of adjusting the command line calls properly I am not able to set this up properly in windows. This has surely helped though! I am not sure where you are heading with this part. I am able to extract it just fine with 7zip. The issue is the next step. I feel there needs to be some information on the django site that says okay windows users have extracted your command will look like this: ... to execute the .tar file. Not to mention the cd or current directory command can be used to change your location to properly aligned your current directory as well as placing the extracted .tar file in this location you move to in the command prompt. As for formatting purporses I am the most familiar with .zip files they are extremely simple to work with, especially in a windows environment. I do have experience with .tar however it DID NOT click that this was a UNIX kernel command. As I am in windows and just assumed that was for me. :/ Cheers JJ On Nov 24, 10:37 am, Tom Evans wrote: > On Thu, Nov 24, 2011 at 5:00 AM, JJ Zolper wrote: > > Hello, > > > I am new to Django! I was able to download and install: Python 2.7.2 > > x86 64 on my Windows 7 64 bit machine. I think that is all that I will > > need to execute the command line? > > > I installed Python to C:/Python27 as the program intended. > > > I then downloaded: Django-1.3.1.tar.gz file and was try to figure > > where to go to next. I used the 7 zip to extract it to: > > Django-1.3.1.tar. But I wasn't sure the next steps. I opened the > > Python cmd prompt. I typed the command in: tar xzvf Django-*.tar.gz. > > But I got errors about the portion "xzvf" I feel that the directories > > are not set up correctly. Do I need to adjust my command for the > > directory because I already tried that. > > > I would really appreciate a step through that would get me all set up > > with the baseline. I am interested to moving on from to the more in > > depth chapters. I tried hard to understand the input from the comments > > on the page but I was unable to find anything that gave me any sense > > of direction on how to place the Django files. > > > Thanks! > > > JJ > > > PS. sorry this is available and I didn't see it in the new booklet. > > tar.gz is a gzipped (.gz) tape archive (.tar) file. 7zip should be > able to gunzip it and extract the files from the archive - it might > require two steps. > > The 'tar xzvf…' command is how one extracts a tar.gz under unix/linux > from the OS command line - not the python command line. As the docs > say, you can download and install bsdtar in windows, in which case the > OS command would be 'bsdtar zxvf …'. > > This is the second time this week someone has had issues extracting a > tgz on windows - any chance that django could be packaged up in a more > Windows friendly zip file format in addition to tgz? > > Cheers > > Tom > > https://docs.djangoproject.com/en/1.3/topics/install/#installing-an-o... -- 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: Installation of Django
JoeLinux, Oh interesting. It seems the 64 bit version is sort of unclear. Any help there? Would I be able to install my Python is well with a smaller command? I am back at ground zero because I had to adjust the Python version back to 2.5 so Django would agree. I am interested just not sure how to work the 64 bit version. Thanks! JJ On Nov 24, 11:40 am, Joey Espinosa wrote: > If you install the "setuptools" package (http://goo.gl/UjFh), then all you > have to do to install Django (or any other Python library) is this: > > easy_install django > > And it will handle the rest. Just a suggestion. > > -- > Joey "JoeLinux" Espinosa > Software Developerhttp://about.me/joelinux > On Nov 24, 2011 10:37 AM, "Tom Evans" wrote: > > > > > > > > > On Thu, Nov 24, 2011 at 5:00 AM, JJ Zolper wrote: > > > Hello, > > > > I am new to Django! I was able to download and install: Python 2.7.2 > > > x86 64 on my Windows 7 64 bit machine. I think that is all that I will > > > need to execute the command line? > > > > I installed Python to C:/Python27 as the program intended. > > > > I then downloaded: Django-1.3.1.tar.gz file and was try to figure > > > where to go to next. I used the 7 zip to extract it to: > > > Django-1.3.1.tar. But I wasn't sure the next steps. I opened the > > > Python cmd prompt. I typed the command in: tar xzvf Django-*.tar.gz. > > > But I got errors about the portion "xzvf" I feel that the directories > > > are not set up correctly. Do I need to adjust my command for the > > > directory because I already tried that. > > > > I would really appreciate a step through that would get me all set up > > > with the baseline. I am interested to moving on from to the more in > > > depth chapters. I tried hard to understand the input from the comments > > > on the page but I was unable to find anything that gave me any sense > > > of direction on how to place the Django files. > > > > Thanks! > > > > JJ > > > > PS. sorry this is available and I didn't see it in the new booklet. > > > tar.gz is a gzipped (.gz) tape archive (.tar) file. 7zip should be > > able to gunzip it and extract the files from the archive - it might > > require two steps. > > > The 'tar xzvf…' command is how one extracts a tar.gz under unix/linux > > from the OS command line - not the python command line. As the docs > > say, you can download and install bsdtar in windows, in which case the > > OS command would be 'bsdtar zxvf …'. > > > This is the second time this week someone has had issues extracting a > > tgz on windows - any chance that django could be packaged up in a more > > Windows friendly zip file format in addition to tgz? > > > Cheers > > > Tom > > >https://docs.djangoproject.com/en/1.3/topics/install/#installing-an-o... > > > -- > > 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: Installation of Django
On Thu, Nov 24, 2011 at 4:52 PM, JJ Zolper wrote: > Tom, > > 7zip works great. I am able to unzip the .tgz file and I have my .tar > file. Now it is on to installation of it. > OK, you're still not getting it. You haven't extracted anything, you've gunzipped it. You now must use 7zip, or another tar aware program like the command line bsdtar, to extract the contents of the tar archive. You should not need at any stage a .tar file! If you have gunzipped the .tar.gz file to give you a .tar file, the bsdtar command would be different - it would be bsdtar xvf Djang-1.3.1.tar - omitting the 'z' flag, which stands for 'gunzip/gzip' the archive ('x' is extract, 'v' verbose, 'f' 'from a file'). Cheers Tom -- 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: Installation of Django
On Thursday, 24 November 2011 16:55:06 UTC, JJ Zolper wrote: > > JoeLinux, > > Oh interesting. It seems the 64 bit version is sort of unclear. Any > help there? > > Would I be able to install my Python is well with a smaller command? I > am back at ground zero because I had to adjust the Python version back > to 2.5 so Django would agree. > > Would agree with what? Django is perfectly compatible with Python 2.7. -- DR. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZbE6FIcOUqMJ. 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: Installation of Django
> windows users have extracted your command will look like this: ... > to execute the .tar file. as tom mentioned, you have to use 7zip two times. the tar file is another archive (like .zip, .gz ) which you have to decompress and then you have the django directory and you can go on with the tutorial. On Nov 24, 2011, at 17:55 , JJ Zolper wrote: > JoeLinux, > > Oh interesting. It seems the 64 bit version is sort of unclear. Any > help there? > > Would I be able to install my Python is well with a smaller command? I > am back at ground zero because I had to adjust the Python version back > to 2.5 so Django would agree. > > I am interested just not sure how to work the 64 bit version. > > Thanks! > > JJ > > On Nov 24, 11:40 am, Joey Espinosa wrote: >> If you install the "setuptools" package (http://goo.gl/UjFh), then all you >> have to do to install Django (or any other Python library) is this: >> >> easy_install django >> >> And it will handle the rest. Just a suggestion. >> >> -- >> Joey "JoeLinux" Espinosa >> Software Developerhttp://about.me/joelinux >> On Nov 24, 2011 10:37 AM, "Tom Evans" wrote: >> >> >> >> >> >> >> >>> On Thu, Nov 24, 2011 at 5:00 AM, JJ Zolper wrote: Hello, >> I am new to Django! I was able to download and install: Python 2.7.2 x86 64 on my Windows 7 64 bit machine. I think that is all that I will need to execute the command line? >> I installed Python to C:/Python27 as the program intended. >> I then downloaded: Django-1.3.1.tar.gz file and was try to figure where to go to next. I used the 7 zip to extract it to: Django-1.3.1.tar. But I wasn't sure the next steps. I opened the Python cmd prompt. I typed the command in: tar xzvf Django-*.tar.gz. But I got errors about the portion "xzvf" I feel that the directories are not set up correctly. Do I need to adjust my command for the directory because I already tried that. >> I would really appreciate a step through that would get me all set up with the baseline. I am interested to moving on from to the more in depth chapters. I tried hard to understand the input from the comments on the page but I was unable to find anything that gave me any sense of direction on how to place the Django files. >> Thanks! >> JJ >> PS. sorry this is available and I didn't see it in the new booklet. >> >>> tar.gz is a gzipped (.gz) tape archive (.tar) file. 7zip should be >>> able to gunzip it and extract the files from the archive - it might >>> require two steps. >> >>> The 'tar xzvf…' command is how one extracts a tar.gz under unix/linux >>> from the OS command line - not the python command line. As the docs >>> say, you can download and install bsdtar in windows, in which case the >>> OS command would be 'bsdtar zxvf …'. >> >>> This is the second time this week someone has had issues extracting a >>> tgz on windows - any chance that django could be packaged up in a more >>> Windows friendly zip file format in addition to tgz? >> >>> Cheers >> >>> Tom >> >>> https://docs.djangoproject.com/en/1.3/topics/install/#installing-an-o... >> >>> -- >>> 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: Named URLs Error
Traceback: http://pastebin.com/9nLp4uP5 > Confused, how does creating a new app and importing urls.py from that > test the validity of the urls.py in your current app? I did this to make sure no other app was causing errors. Without starting a new app(!), can you import > from 'products.urls' successfully? Yes On Nov 24, 11:45 am, Tom Evans wrote: > On Thu, Nov 24, 2011 at 3:43 PM, eeyore wrote: > > Tom, > > > 1) The 'product' directory is not a module itself - it has no > > __init__.py > > > The 'product' directory has __init.__.py > > > 2) You have two modules called 'product', and it is attempting to > > import urls from the 'wrong one'. > > > I created a new app with only one module to test it. > > > "from product.urls import urlpatterns" > > > Returns no errors. > > Confused, how does creating a new app and importing urls.py from that > test the validity of the urls.py in your current app? > > I got the name of your app wrong in my initial mail, I see it is > actually 'products'. Without starting a new app(!), can you import > from 'products.urls' successfully? > > The traceback clearly indicates that it cannot import a url conf > because of import errors. You need to track down what that error is. > If you still can't, paste the entire traceback so that we have more > information to go on. > > Cheers > > Tom -- 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: Installation of Django
On Thursday, 24 November 2011 16:52:00 UTC, JJ Zolper wrote: > > Tom, > > 7zip works great. I am able to unzip the .tgz file and I have my .tar > file. Now it is on to installation of it. > > .tar is stil an archive. You need to extract that as well - 7zip should be able to do the job. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kZLgTUVQS9kJ. 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: converting to a template
On Thu, Nov 24, 2011 at 4:40 PM, marjenni wrote: > > I have a python script in which I am building up an html page, and > then making a call to HttpResponse(html) to show the page. > > > Now I want to start to using templates, but this is not as easy as I > hoped because my html contains a table with a lot of information, and > I don't know how to make function calls from the template. > > Are there any clear examples of how to dynamically create a table from > within a template? > By design, you can't really make function calls from within templates*. The reason for this is that if you do, your template is no longer really a template, but more like a program or script. Template languages are astonishingly bad at writing logic in, you end up with confusing templates and hidden logic, so Django deliberately forces you to do as much work as possible in your view, and pass in the data required in a simple enough format to draw your view. Eg, if you were outputting a table, you should generate your data as a list of lists, and pass it to the template in the context. You can then iterate through the list, generating a row for each list. So, the real question is always "what data structures do I need to massage my data into so that I can output it cleanly in my template". Cheers Tom * This is not true, you can. But they are limited to functions which do not take arguments, or by writing custom template filters or tags. -- 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: Named URLs Error
On Thu, Nov 24, 2011 at 4:58 PM, eeyore wrote: > > Traceback: > > http://pastebin.com/9nLp4uP5 > >> Confused, how does creating a new app and importing urls.py from that >> test the validity of the urls.py in your current app? > > I did this to make sure no other app was causing errors. > > > Without starting a new app(!), can you import >> from 'products.urls' successfully? > > Yes > > OK. In the django shell: >>> from django.core.urlresolvers import reverse >>> reverse('products_index') Any errors? Is your django shell from the same instance (same code files) as the web? Cheers Tom -- 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 uninstall the django version
I installed django and python in a different directory but it is still using /usr/local/bin and not python 2.7 and gives path error. Should I delete the python2.6 version for it to work with 2.7? On Tue, Nov 22, 2011 at 4:32 PM, Andre Terra wrote: > Ideally, after removing django, you should NOT install it on your > site-packages this time around. > > Instead, install virtualenv[1] and proceed from there. Learn it. It will > pay off! > > Bonus points if you use pip[2][3] as well. > > > > Cheers, > AT > > [1] http://pypi.python.org/pypi/virtualenv > [2] http://pypi.python.org/pypi/pip > [3] > http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/ > > > > > On Tue, Nov 22, 2011 at 2:15 PM, Nikhil Verma wrote: > >> >> Hey ram >> >> If you are in ubuntu (linux/unix) you need to got to >> 1) /usr/local/lib/python2.6/dist-packages >> 2) when you do ls there will be directory called django. >> 3) do rm -rf django. >> By doing this django will be removed.Now you can install any version of >> django you want. >> >> If you are windows you need to program files then python2.x then agin in >> site-packages delete the django folder and you are good to install the >> required version you want.(What i remember ?) >> >> Please specify your environment conditions also. >> >> Hope this may help you !!! >> -- >> Regards >> Nikhil Verma >> +91-958-273-3156 >> >> >> On Tue, Nov 22, 2011 at 5:39 PM, ram wrote: >> >>> i want to uninstall my django version (1.3.1) and again i want to >>> install the same version.can any one say me how to solve it. >>> >>> -- > 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. > -- TANYA -- 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: Named URLs Error
Here is the traceback: http://pastebin.com/AXrfkAiW Matt On Nov 24, 12:07 pm, Tom Evans wrote: > On Thu, Nov 24, 2011 at 4:58 PM, eeyore wrote: > > > Traceback: > > >http://pastebin.com/9nLp4uP5 > > >> Confused, how does creating a new app and importing urls.py from that > >> test the validity of the urls.py in your current app? > > > I did this to make sure no other app was causing errors. > > > Without starting a new app(!), can you import > >> from 'products.urls' successfully? > > > Yes > > OK. In the django shell: > > >>> from django.core.urlresolvers import reverse > >>> reverse('products_index') > > Any errors? > > Is your django shell from the same instance (same code files) as the web? > > Cheers > > Tom -- 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.
Delete a Field...
Hello, I have a question that I have not been resolved, well three, took and a few days researching the subject, but this being impossible I would appreciate your help, as they are the last 3 points I have left to complete a project: I have the class: class Proyectos(models.Model): titulo=models.CharField(max_length=100) creacion=models.DateField(default=datetime.datetime.now) estado=models.CharField(max_length=30) objetivo=models.TextField(null=True) conclusion=models.TextField(null=True) porcentaje=models.IntegerField() modificado=models.DateTimeField(default=datetime.datetime.now) autor=models.IntegerField() usuarios=models.ManyToManyField(User) proyectos_rel=models.ManyToManyField("self") documentos=models.ManyToManyField(Documentos) class Meta: db_table='Proyectos' def __unicode__(self): return self.titulo In my application will appear that a project may have multiple users that are related to it, the problem is when after a call to a function. js, I want to eliminate one of those users. For example: "foo", "pepe1", "pepe2" are users of the project. I delete returns "foo" I try in every way like this: datos=Proyectos.objects.get(id=identificador) if request.POST.get('usuarios','')!='': datos.usuarios.add(request.POST.get('usuarios')) if request.POST.get('usuariosDelete','')!='': datos.usuarios=[] What this does is to completely eliminate the Project, in which the user is. Or there is the following; if request.POST.get('usuariosDelete','')!='': for i in request.POST.getlist('usuarios'): usuario=User.objects.get(id=i) datos.usuarios.remove(usuario) This second form can not get any results ... And I can not create stories or intermediate classes, because the model is already defined. Thank you very much beforehand, really it's something I need, Thank you. -- 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.
Upload a file
My last question is whether anyone can tell me how to upload files of any kind, not just image. I've got the image, changing the picture of a user (in my program) but do not know how to upload files ... Thanks in advance. -- 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.
Automatic Submit
I get that it was not necessary to press the button "Save" for the sbmit. Do so without having to press the button(save or enter), that when you pass this sequence is executed automatically. 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.
Django 1.4 (dev) doesn't redirect to i18n url when debug is false
Hello, I have an app using Django 1.4 dev. Im using i18n_patterns and well, it works perfectly. If im on a spanish session and I go to: /foo/ It redirects me to: /es/foo/ so far so good. But when I disable DEBUG, it doesn't work. If you go to: /foo/ it just redirect you to 500.html. Without DEBUG Im not able to debug, right? So... How can I figure what's going on? I uploaded an example: http://dl.dropbox.com/u/10283624/dalpharedirect.zip Its just a hello world :) Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ohHuHV-1fOoJ. 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: Upload a file
2011/11/24 jose osuna perez : > My last question is whether anyone can tell me how to upload files > of any kind, not just image. > I've got the image, changing the picture of a user (in > my program) > but do not know how to upload files ... > Thanks in advance. José, this is explained int the django docs https://docs.djangoproject.com/en/dev/topics/http/file-uploads/ -- Antoni Aloy López Blog: http://trespams.com Site: http://apsl.net -- 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: Automatic Submit
2011/11/24 jose osuna perez : > I get that it was not necessary to press the button "Save" > for the sbmit. > > value = "Save" /> > This is not a Django related question, it's more a javascript one. You can use jQuery with jQuery Forms http://jquery.malsup.com/form/ Hope it helps! -- Antoni Aloy López Blog: http://trespams.com Site: http://apsl.net -- 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.
Basic installation
I'm at a loss as to installing Django - and I have spent the day reading the documentation, the FAQ etc. I understand that I should download django, unzip and un-tar, and then run setup.py in the resulting directory. When I do this, I get a bunch of stuff in that directory, and nothing in my Python site-packages directory. I wish to have my pure-python site packages in a separate directory, C: \Python\site-packages, because they are not specific to one of the Python versions I have installed. I have added a .pth file to PythonXX/ lib/site-packages to include the 'global' packages, and a distutils.cfg file to tell distutils about my install preferences. Django installs to its own directory, not to my requested directory or even to the default 'site-packages directory. What am I missing?? Does Django's included setup.py just ignore such details? -- 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: Help with many-to-many field update
Hey Leslie, Try add() method like in this answer on SO http://stackoverflow.com/questions/1226290/django-manytomany-relation-add-error Cheers, On 25 November 2011 00:43, Nichehosters wrote: > Hi, > I am relatively new to Django, and am trying to update a many-to-many > related table using a ModelForm. > I see fro the documentation that if I use save(commit=False) - which I > do - I need to use save_m2m() after saving the initial form. I am > using the save_m2m(), but my related table does not get updated. > Any help appreciated. > I am using django V1.3.1 on linux using Postgresql as the db. > > Details: > > The Model: > class srvorders(models.Model): >client = models.CharField('Client', max_length=200) >server = models.CharField('Server Type', max_length=200) >os = models.CharField('Operating System', max_length=200) >osopts = models.CharField('Operating System Options', > max_length=200, blank=True, null=True) >ordertotal = models.IntegerField() >notes = models.TextField('Notes', blank=True, null=True) >orderdate = models.DateTimeField() >orderIP = models.IPAddressField() >status = models.CharField('Order Status', max_length="20") >srvopts = models.ManyToManyField(srvoptions, blank=True, > null=True) > > class Meta: >ordering = ["id"] >verbose_name_plural = "Server Orders" > > def __unicode__(self): >return str(self.id) > > class Admin: >pass > > The ModelForm: > class NewOrderForm(forms.ModelForm): >Server_CHOICES = [('', '-- choose a Server --'), ] + [(s.id, > s.name) for s in products.objects.all()] >OS_CHOICES = [('', '-- choose a Server --'), ] +[(o.id, o.name) > for o in OS.objects.all()] >OPTION_CHOICES = [('', '-- choose a Server --'), ] +[(opt.id, > opt.name) for opt in osoptions.objects.all()] > > server=forms.ChoiceField(choices=Server_CHOICES) > os = forms.ChoiceField(choices=OS_CHOICES) > osopts=forms.ChoiceField(choices=OPTION_CHOICES, required=False) > ordertotal=forms.CharField(required=False) > notes=forms.CharField(required=False) > > class Meta: >model= srvorders >exclude = ('client', 'orderdate', 'orderIP', 'status') > > The View snippet: > if request.method == 'POST': >form = NewOrderForm(request.POST) >if form.is_valid(): >new_item = form.save(commit=False) >new_item.client = orderClient >new_item.orderdate = datetime.now() >new_item.orderIP = remote_ip >new_item.status = "Not_Paid" >new_item.save() >form.save_m2m() > > Regards, > Leslie > > -- > 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: Basic installation
On Nov 24, 3:02 pm, ek_wals wrote: > I'm at a loss as to installing Django - and I have spent the day > reading the documentation, the FAQ etc. > I understand that I should download django, unzip and un-tar, and then > run setup.py in the resulting directory. When I do this, I get a bunch > of stuff in that directory, and nothing in my Python site-packages > directory. > > I wish to have my pure-python site packages in a separate directory, C: > \Python\site-packages, because they are not specific to one of the > Python versions I have installed. I have added a .pth file to PythonXX/ > lib/site-packages to include the 'global' packages, and a > distutils.cfg file to tell distutils about my install preferences. > > Django installs to its own directory, not to my requested directory or > even to the default 'site-packages directory. > > What am I missing?? Does Django's included setup.py just ignore such > details? Read the manual stupid -- or in this case the Python distutils source code! It works fine -- 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.
Reverse and variables in template
Hello, The following line in my template return an error: Modifier Error is: Could not parse the remainder: '{{' from '{{' If i use (has view in the doc): Modifier it works fine. Then is the syntax {% url url_name {{model.field}} %} allowed ? Somebody has an idea ? Thanks for your precious help. Regards youpsla -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1IxshdRdwksJ. 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: Installation of Django
JoeLinux, I read on the Django site that versions 2.3 to 2.6 where the appropiate versions of Python for the Django code. That's what I meant by agree. Does it work fine with 2.7 Python? JJ On Thu, Nov 24, 2011 at 11:57 AM, Daniel Roseman wrote: > On Thursday, 24 November 2011 16:55:06 UTC, JJ Zolper wrote: >> >> JoeLinux, >> >> Oh interesting. It seems the 64 bit version is sort of unclear. Any >> help there? >> >> Would I be able to install my Python is well with a smaller command? I >> am back at ground zero because I had to adjust the Python version back >> to 2.5 so Django would agree. >> >> Would agree with what? Django is perfectly compatible with Python 2.7. > > -- > DR. > >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/ZbE6FIcOUqMJ. > > 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: Reverse and variables in template
Don't use brackets around the variables. On Nov 25, 2011, at 1:48, youpsla wrote: > Hello, > > The following line in my template return an error: > Modifier > > Error is: > Could not parse the remainder: '{{' from '{{' > > If i use (has view in the doc): > Modifier > it works fine. > > Then is the syntax {% url url_name {{model.field}} %} allowed ? > > Somebody has an idea ? > > Thanks for your precious help. > > Regards > > youpsla > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/1IxshdRdwksJ. > 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: Reverse and variables in template
Thnaks a lots, it works. Youpsla -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZATE6UT7dWwJ. 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.
filesystem path in settings.py
# Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" MEDIA_ROOT = '' I want to upload css files and images so must I put them in /home/media or /home/my/media/path/ ? Should the filesystem path in settings.py be changed or should MEDIA_ROOT be left empty? -- TANYA -- 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: filesystem path in settings.py
Hi, Please read this whole thing https://docs.djangoproject.com/en/dev/howto/static-files/ On Fri, Nov 25, 2011 at 6:28 AM, TANYA wrote: > # Absolute filesystem path to the directory that will hold user-uploaded > files. > # Example: "/home/media/media.lawrence.com/media/" > MEDIA_ROOT = '' > > I want to upload css files and images so must I put them in /home/media or > /home/my/media/path/ ? Should the filesystem path in settings.py be changed > or should MEDIA_ROOT be left empty? > > -- > TANYA > > -- > 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: filesystem path in settings.py
And this too http://www.djangobook.com/en/2.0/ On Fri, Nov 25, 2011 at 7:41 AM, Timothy Makobu wrote: > Hi, > > Please read this whole thing > https://docs.djangoproject.com/en/dev/howto/static-files/ > > > On Fri, Nov 25, 2011 at 6:28 AM, TANYA wrote: > >> # Absolute filesystem path to the directory that will hold user-uploaded >> files. >> # Example: "/home/media/media.lawrence.com/media/" >> MEDIA_ROOT = '' >> >> I want to upload css files and images so must I put them in /home/media >> or /home/my/media/path/ ? Should the filesystem path in settings.py be >> changed or should MEDIA_ROOT be left empty? >> >> -- >> TANYA >> >> -- >> 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: Basic installation
- Install setup tools http://pypi.python.org/pypi/setuptools/0.6c11 - Go to the command line (cmd.exe) and type - easy_install django - easy_install ipython (not needed by django, but very useful, as you will see when you come to running "python manage.py shell" Then read this WHOLE thing http://www.djangobook.com/en/2.0/ On Fri, Nov 25, 2011 at 3:29 AM, ek_wals wrote: > > > On Nov 24, 3:02 pm, ek_wals wrote: > > I'm at a loss as to installing Django - and I have spent the day > > reading the documentation, the FAQ etc. > > I understand that I should download django, unzip and un-tar, and then > > run setup.py in the resulting directory. When I do this, I get a bunch > > of stuff in that directory, and nothing in my Python site-packages > > directory. > > > > I wish to have my pure-python site packages in a separate directory, C: > > \Python\site-packages, because they are not specific to one of the > > Python versions I have installed. I have added a .pth file to PythonXX/ > > lib/site-packages to include the 'global' packages, and a > > distutils.cfg file to tell distutils about my install preferences. > > > > Django installs to its own directory, not to my requested directory or > > even to the default 'site-packages directory. > > > > What am I missing?? Does Django's included setup.py just ignore such > > details? > > Read the manual stupid -- or in this case the Python distutils source > code! > > It works fine > > -- > 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.
How to add middle ware Selecting the current time zone
How to add Middleware to my code. I cant import from django.utils import timezone please guide me. How to import timezone. I already installed pytz. any one help me. any clues. Here's an example that stores the current timezone in the session. (It skips error handling entirely for the sake of simplicity.) Add the following middleware to MIDDLEWARE_CLASSES: from django.utils import timezone class TimezoneMiddleware(object): def process_request(self, request): tz = request.session.get('django_timezone') if tz: timezone.activate(tz) https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#selecting-the-current-time-zone -Ganesh Did I learn something today? If not, I wasted it. -- 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: Delete a Field...
Hello, I'm not familiar with ManyToMany relationships since I use Django with mongodb and this doesn't exist like so. But I'll give it a shot : > For example: "foo", "pepe1", "pepe2" are users of the project. I > delete returns "foo" > I try in every way like this: > datos=Proyectos.objects.get(id=identificador) > if request.POST.get('usuarios','')!='': > datos.usuarios.add(request.POST.get('usuarios')) > if request.POST.get('usuariosDelete','')!='': > datos.usuarios=[] First it only tries to delete a user if a user is added, is it intended ? Then here : >datos.usuarios.add(request.POST.get('usuarios')) Here you're adding the username from the form when there is a User object expected ? >I want to eliminate one of those >users. So why trying to do datos.usuarios=[] ? Should be datos.usuarios.remove(the_user_you_want_to_remove). -- 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: Help with many-to-many field update
Hi Mario, Thanks so much - I updated my view as below and it is now working as expected! Regards, Leslie if form.is_valid(): new_item = form.save(commit=False) new_item.client = orderClient new_item.orderdate = datetime.now() new_item.orderIP = remote_ip new_item.status = "Not_Paid" new_item.save() form.save_m2m() ordernumber = new_item.pk for opt in request.POST.getlist('srvoptions'): theopt = srvoptions.objects.get(pk=opt) new_item.srvopts.add(theopt.id) On Fri, Nov 25, 2011 at 1:40 AM, Mario Gudelj wrote: > Hey Leslie, > > Try add() method like in this answer on SO > http://stackoverflow.com/questions/1226290/django-manytomany-relation-add-error > > Cheers, > > On 25 November 2011 00:43, Nichehosters wrote: > >> Hi, >> I am relatively new to Django, and am trying to update a many-to-many >> related table using a ModelForm. >> I see fro the documentation that if I use save(commit=False) - which I >> do - I need to use save_m2m() after saving the initial form. I am >> using the save_m2m(), but my related table does not get updated. >> Any help appreciated. >> I am using django V1.3.1 on linux using Postgresql as the db. >> >> Details: >> >> The Model: >> class srvorders(models.Model): >>client = models.CharField('Client', max_length=200) >>server = models.CharField('Server Type', max_length=200) >>os = models.CharField('Operating System', max_length=200) >>osopts = models.CharField('Operating System Options', >> max_length=200, blank=True, null=True) >>ordertotal = models.IntegerField() >>notes = models.TextField('Notes', blank=True, null=True) >>orderdate = models.DateTimeField() >>orderIP = models.IPAddressField() >>status = models.CharField('Order Status', max_length="20") >>srvopts = models.ManyToManyField(srvoptions, blank=True, >> null=True) >> >> class Meta: >>ordering = ["id"] >>verbose_name_plural = "Server Orders" >> >> def __unicode__(self): >>return str(self.id) >> >> class Admin: >>pass >> >> The ModelForm: >> class NewOrderForm(forms.ModelForm): >>Server_CHOICES = [('', '-- choose a Server --'), ] + [(s.id, >> s.name) for s in products.objects.all()] >>OS_CHOICES = [('', '-- choose a Server --'), ] +[(o.id, o.name) >> for o in OS.objects.all()] >>OPTION_CHOICES = [('', '-- choose a Server --'), ] +[(opt.id, >> opt.name) for opt in osoptions.objects.all()] >> >> server=forms.ChoiceField(choices=Server_CHOICES) >> os = forms.ChoiceField(choices=OS_CHOICES) >> osopts=forms.ChoiceField(choices=OPTION_CHOICES, required=False) >> ordertotal=forms.CharField(required=False) >> notes=forms.CharField(required=False) >> >> class Meta: >>model= srvorders >>exclude = ('client', 'orderdate', 'orderIP', 'status') >> >> The View snippet: >> if request.method == 'POST': >>form = NewOrderForm(request.POST) >>if form.is_valid(): >>new_item = form.save(commit=False) >>new_item.client = orderClient >>new_item.orderdate = datetime.now() >>new_item.orderIP = remote_ip >>new_item.status = "Not_Paid" >>new_item.save() >>form.save_m2m() >> >> Regards, >> Leslie >> >> -- >> 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. > -- Regards, MyGolf http://www.mygolf.za.net -- 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.