Re: Query with 3 models

2012-07-19 Thread Python_Junkie
If you are comfortable with sql syntax, just pull the data you want with 
sql joins.

You already have the keys set up

On Thursday, July 19, 2012 5:16:42 AM UTC-4, Julio Galvez wrote:
>
> Hi, I'm new with Django and in this Groups; I have the next models and 
> question
>
> class Empresa(models.Model):
> usuario = models.ForeignKey(User)
> empresa = models.CharField(max_length=100, unique=True)
> slogan =  models.TextField()
> logotipo = models.ImageField(upload_to='logos')
> descripcion = models.TextField()
> compra_minima = models.FloatField(verbose_name='Compra Mínima')
> costo_envio = models.FloatField(verbose_name='Costo de Envío')
>
> def __unicode__(self):
> return self.empresa
>
> class Sucursal(models.Model):
> empresa = models.ForeignKey(Empresa)
> direccion = models.CharField(max_length=200, null=False)
> estado = models.CharField(max_length=30)
> municipio = models.CharField(max_length=30)
>
> def __unicode__(self):
> return self.direccion
>
> class Platillo(models.Model):
> empresa = models.ForeignKey(Empresa)
> categoria = models.ForeignKey(Categoria_platillo)
> nombre_platillo = models.CharField(max_length=100, null=False, 
> blank=False, verbose_name='Nombre del Platillo')
> fotografia = models.ImageField(upload_to='platillos', 
> verbose_name='Fotografía')
> descripcion = models.TextField()
> precio = models.FloatField()
> dia_existencia = models.CharField(max_length=150)
> fecha_publicacion = models.DateTimeField(auto_now=True)
> tags = models.CharField(max_length=100)
> estatus = models.BooleanField(null=False, default=True)
>
> def __unicode__(self):
> return self.nombre_platillo
>
> class Horario(models.Model):
> empresa = models.ForeignKey(Empresa)
> dia = models.CharField(max_length=15)
> hora_abre = models.CharField(max_length=10)
> hora_cierra = models.CharField(max_length=10)
>
> def __unicode__(self):
> return self.hora_abre
>
>
> Now, I want to create a result like this:
>
> {Empresa1, Sucursal1, Platillo1, Horario1}, {Empresa1, Sucursal1, 
> Platillo2, Horario1}, {Empresa2, Sucursal1, Platillo1, Horario1}...
>
> I use "select_related()" method, but I can't do it
>

-- 
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/-/hSJcX7Zqf9QJ.
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 Why does the create project command create 2 identical folders

2012-06-26 Thread Python_Junkie
When one creates a project with django-admin.py why is a second my site 
folder created?

Mysite
Mysite
polls

Thanks in advance.

What is its function/value in this new version

-- 
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/-/wSdsYgVkNGAJ.
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: Is this requirement feasible with django

2012-06-03 Thread Python_Junkie
I hope my answer points you in the right direction.

I would create 2 (generic) tables one  that is called something like 
test_definition, since you have a wide variety of tests.

And then create a table called test results.

The forms that the user fills in would be created dynamically through the 
view by extracting the appropriate row information from the test_definition 
table.


Reports results can be created by joining the test_definition table with 
the test_results table.

The test_results table would be appear to be genric, ie column_A, Column_B. 
but pull the required metadata from the test_definition field.

Hence you would only need 2 models

On Sunday, June 3, 2012 4:02:33 AM UTC-4, Kalpa Welivitigoda wrote:
>
> Hi, 
>
> I want to develop a web based laboratory test reporting system. It 
> basically involves storing the records of different tests for 
> different patient and get a print out of the reports. There are around 
> 100 tests with different fields. 
>
> The flow would be that the user enters a patient id and the tests for 
> that person appears, then he selects one test and a input form appears 
> to enter test results. This continues for the other tests as well and 
> finally a print out is issued and a pdf of the report is generated on 
> request. 
>
> Since there are around 100 tests (with different fields), do I need to 
> write separate models and views (to view the data input form) for each 
> and every one of them or can it be made simpler at least generating 
> views (because views are generated from some of the fields in the 
> model) ? 
>
> -- 
> Best Regards, 
>
> Kalpa Pathum Welivitigoda 
> http://about.me/callkalpa 
>

-- 
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/-/2gngiSyXXXoJ.
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 syncdb and sql server does not create dbo tables

2012-05-29 Thread Python_Junkie
I am creating tables in sql server for the first time.  I usually use mysql.
The tables are created with a domain prefix rather than dbo.table 
(domain\myname.table instead of dbo.table)
How do I get django to creatte the tables the way I want them to be created

-- 
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/-/WxlSd-G2pOQJ.
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: server error occurred. Please contact the administrator.

2012-05-08 Thread Python_Junkie
I am not an expert on the csrf module, but the error is pointing towards 
this module.

I am using 'django.middleware.csrf.CsrfViewMiddleware', with django 1.3 and 
app is working just fine.
If I were you I would research this module in the django web page and focus 
on this module

On Tuesday, May 8, 2012 8:41:52 AM UTC-4, ritvik wrote:
>
> Hey guys i am gettting "server error occurred.  Please contact the 
> administrator."this message while i am running my django 
> application 
>
> my application is not calling even any url   please help me out this 
> is my error log 
>
> Traceback (most recent call last): 
>   File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run 
> self.result = application(self.environ, self.start_response) 
>   File "/usr/local/lib/python2.6/dist-packages/django/contrib/ 
> staticfiles/handlers.py", line 67, in __call__ 
> return self.application(environ, start_response) 
>   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/ 
> wsgi.py", line 216, in __call__ 
> self.load_middleware() 
>   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/ 
> base.py", line 51, in load_middleware 
> raise exceptions.ImproperlyConfigured('Middleware module "%s" does 
> not define a "%s" class' % (mw_module, mw_classname)) 
> ImproperlyConfigured: Middleware module "django.middleware.csrf" does 
> not define a "CsrfResponseMiddleware" class 
>
>
> here is my setting.py file 
>
>
> # Django settings for mysite1 project. 
> import os.path 
>
> DEBUG = True 
> TEMPLATE_DEBUG = DEBUG 
>
> ADMINS = ( 
> # ('Your Name', 'your_em...@example.com'), 
> ) 
>
> MANAGERS = ADMINS 
>
> DATABASES = { 
> 'default': { 
> 'ENGINE': 'django.db.backends.sqlite3', # Add 
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
> 'NAME': '/home/rohitd/workspace/ 
> slm_uidatabase.db',  # Or path to database file if 
> using sqlite3. 
> 'USER': '',  # Not used with sqlite3. 
> 'PASSWORD': '',  # Not used with sqlite3. 
> 'HOST': '',  # Set to empty string for 
> localhost. Not used with sqlite3. 
> 'PORT': '',  # Set to empty string for 
> default. Not used with sqlite3. 
> } 
> } 
>
> # Local time zone for this installation. Choices can be found here: 
> # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 
> # although not all choices may be available on all operating systems. 
> # On Unix systems, a value of None will cause Django to use the same 
> # timezone as the operating system. 
> # If running in a Windows environment this must be set to the same as 
> your 
> # system time zone. 
> TIME_ZONE = 'America/Chicago' 
>
> # Language code for this installation. All choices can be found here: 
> # http://www.i18nguy.com/unicode/language-identifiers.html 
> LANGUAGE_CODE = 'en-us' 
>
> SITE_ID = 1 
>
> # If you set this to False, Django will make some optimizations so as 
> not 
> # to load the internationalization machinery. 
> USE_I18N = True 
>
> # If you set this to False, Django will not format dates, numbers and 
> # calendars according to the current locale 
> USE_L10N = True 
>
> # Absolute filesystem path to the directory that will hold user- 
> uploaded files. 
> # Example: "/home/media/media.lawrence.com/media/" 
> MEDIA_ROOT = os.path.join(os.path.dirname(__file__), "media") 
> # URL that handles the media served from MEDIA_ROOT. Make sure to use 
> a 
> # trailing slash. 
> # Examples: "http://media.lawrence.com/media/";, "http://example.com/ 
> media/ " 
> MEDIA_URL = '/media/' 
>
> # Absolute path to the directory static files should be collected to. 
> # Don't put anything in this directory yourself; store your static 
> files 
> # in apps' "static/" subdirectories and in STATICFILES_DIRS. 
> # Example: "/home/media/media.lawrence.com/static/" 
> STATIC_ROOT = '' 
>
> # URL prefix for static files. 
> # Example: "http://media.lawrence.com/static/"; 
> STATIC_URL = '/static/' 
>
> # URL prefix for admin static files -- CSS, JavaScript and images. 
> # Make sure to use a trailing slash. 
> # Examples: "http://foo.com/static/admin/";, "/static/admin/". 
> ADMIN_MEDIA_PREFIX = '/static/admin/' 
>
> # Additional locations of static files 
> STATICFILES_DIRS = ( 
> # Put strings here, like "/home/html/static" or "C:/www/django/ 
> static". 
> # Always use forward slashes, even on Windows. 
> # Don't forget to use absolute paths, not relative paths. 
> ) 
>
> # List of finder classes that know how to find static files in 
> # various locations. 
> STATICFILES_FINDERS = ( 
> 'django.contrib.staticfiles.finders.FileSystemFinder', 
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
> #'django.contrib.staticfiles.finders.DefaultStorageFinder', 
> ) 
>
> # Make this unique, and don't share it with anybody. 
> SECRET_KEY = 

Re: What actually happens during syncdb?

2012-05-07 Thread Python_Junkie
Syncdb utility is a (very) convenient tool for converting the database model 
from models.py to the physical structure creation in the actual database. 
You can create the physical model without using Syncdb at all if u are 
comfortable with SQL. 
That said, when the admi site tries to read and writ SQL using theORM , the 
model is used by the ORM to understand how to read and write to 

If u do not want to use the ORM the model is of no use. The models.py is an 
interface for the ORM

-- 
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/-/H8BtAJebxP0J.
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: calculate default values for fields based on the content of other fields

2012-04-06 Thread Python_Junkie


Capture the value from the form submitted into a variable.

Use straight sql to query the table and the field that you are interested 
in and translate the field based on sql.

It is not necessary to only use the ORM.

This is an abstraction layer, and sometimes the restrictions based upon 
using this abstraction can block what you want to accomplish.




On Wednesday, April 4, 2012 9:09:40 AM UTC-4, Jaroslav Dobrek wrote:
>
> Hello, 
>
> is there a way to calculate default values for certain fields based 
> on the content of other fields? 
>
> I am implementing a dictionary. Admins are supposed to add words of 
> certain languages and parts-of-speech. Some words of some 
> part-of-speech and language are, on one hand, morphologically very 
> regular, but, one the other hand, come with a huge number of 
> morphological 
> forms. This is true for German adjectives: They usually have 183 
> morphological forms (if form-meaning pairs are counted). On the other 
> hand, there are very few irregular adjectives. The most user-friendly 
> way for admins to code German adjectives would be this: The admin adds 
> a new adjective and types in the adjective's base form: 
>
> base form: |gut| 
>
> Then he clicks some button or saves the adjective or, ideally, does 
> nothing, and the program fills in the 183 fields below, using the base 
> form and 
> assuming that the adjective is regular: 
>
> attributive positive strong masculine nominative singular: |guter| 
> attributive positive strong masculine genitive singular:   |guten| 
> attributive positive strong masculine dative singular: |gutem| 
> attributive positive strong masculine accusative singular: |guten| 
> ... 
> attributive comparative strong masculine nominative singular: | 
> guterer| 
> ... 
>
> The admin now has the possibility to correct the wrong forms before 
> saving the adjective. This way, in the vast majority of cases all the 
> coding is done completely 
> automatically. And for the very few irregular adjectives, the admin 
> only has to modify those 
> forms that have been guessed wrongly. 
>
> Any ideas how to realize this? 
>
> Jaroslav 
>

-- 
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/-/CeiB24voGMsJ.
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: Comma as decimal field

2012-04-05 Thread Python_Junkie
I assume that your problem is that when the data is posted , the ORM when 
submitting it to the database throws the eror.

You need to  place the posted value into a variable and use a python 
replace statement to replace the , with a period.

Not sure what type of validation that you are using.

Putting aside any sort of validation on the number.

new_number=request.post(variable_coming_in)

number=new_number.replace(" ,  " , "  . ")

Then the database won't complain



On Thursday, April 5, 2012 10:27:40 PM UTC-4, ydjango wrote:
>
> What is best way to allow users to enter decimal either as "." or as 
> ",'? 
> Currently if user enter "," django forms throw error. 
>
> I cannot change settings file based on user as same app serves users 
> worldwide.

-- 
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/-/3d4h2YB5Y5MJ.
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 and MS-SQL

2012-04-05 Thread Python_Junkie
I use it for several applicartions.  Not sure that there is any difference 
with the various versions of sql server, except for minor syntax issues.

What did you want to know?

The performance is very good.

I have one application in which I use the admin interface which uses the 
ORM and I have another application that I just use the template system
for a fairly robust version control, software migration application.

For the 2nd application I just use plain old sql and the pyodbc module.
The django app complains if you don't put a connection string for sql 
server in the settings file, so I do that just to keep the appl happy.

Let me know what type of information you are interested in.



On Thursday, April 5, 2012 4:33:01 PM UTC-4, tizonzon wrote:
>
> Hi all,
> Can anyone share his experience about  developing application with django 
> that uses  Microsoft SQL server 2005 or later ?
> And how is it in production environment.
>
>
> 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/-/OPO1xBT_hFMJ.
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: canceling account

2012-04-01 Thread Python_Junkie
It does not appear that anyone truly answered your question.

The accounts are maintained in a database.

Figure out which table and which columns the account that you want to 
remove are maintained.  You can accomplish this by viewing a development 
server that you may have in house and spinning up a new instance and create 
an admin account.

Then just delete the account from the database to remove the person that 
you want to remove.

Or you could just change the name  so that you have control of the account 
your self.

Good luck

On Saturday, March 31, 2012 9:52:20 AM UTC-4, JoeLinux wrote:
>
> Lilian,
>
> To be clear here, Django is a web framework for creating web applications. 
> Then there are web hosting services out there that will let you run your 
> Django applications on their servers. Within your own Django application, 
> you may have administrative accounts setup.
>
> What account (and where) is it that you need removed, exactly?
>
> --
> Joey Espinosa
> Software Engineer
> http://about.me/joelinux
> On Mar 31, 2012 9:44 AM, "Sergiy Khohlov"  wrote:
>
>> Hello,
>>  What do you  mean ?
>> Each  django application has  ability to add  django superuser account.
>> Also hoster company provide a  account  for setting django application
>>  at the host.
>> Please clarify  what do you want to do
>>
>>  Thanks,
>> Serge
>>
>> 2012/3/31 Lillian Cauldwell :
>> >
>> > My previous webmaster set up my company's d'jango account.
>> > He no longer works for me.
>> > How do I cancel my account?
>> >
>> > Thanks,
>> > Lillian
>> > --
>> > "Creator" Cauldwell
>> > CEO, Passionate World Radio, Inc.
>> > Distinguish Yourself From the Ordinary! (c) 2010-2011 PWR
>> > http://www.internetvoicesradio.com
>> > http://www.amazingworldsoflscauldwell.com
>> > http://pwrwebtv.intuitwebsites.com
>> > 734-827-9407
>> >
>> > --
>> > 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ATwivI_wFU0J.
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 With Tweepy

2012-03-28 Thread Python_Junkie
I believe he means using the Object Relational Model  ORM, which is an API 
abstraction for several frameworks.

Whether you use sql or the ORM (you can learn more about the ORM on the 
django project tutorial) only clouds the issue that you are trying to answer

SQL is SQL whether you make an abstraction layer or not

On Wednesday, March 28, 2012 7:07:22 PM UTC-4, coded kid wrote:
>
> Thanks guys!  @Pachnis How do you mean by Django API queries? 
>
> On Tuesday, 27 March 2012 08:59:28 UTC+1, coded kid wrote:
>>
>> Hi guys, I’m confused on how to make this work. I want to stream 
>> user’s tweets in my django app using tweepy. I’ve written the 
>> streaming code but the problem I’m facing is: should I paste the code 
>> in views.py and input- return 
>> render_to_response('tweet.html',context_instance=RequestContext(request)) 
>> after writing the code. Just like this: 
>>
>>
>> Q= sys.argv[1:] 
>>
>> db=MySQLdb.connect("localhost","","","Juzme") 
>>
>> auth=tweepy.OAuthHandler(consumer_key, consumer_secret) 
>> auth.set_access_token(access_token, access_token_secret) 
>>
>> cur=db.cursor() 
>>
>> class CustomStreamListener(tweepy.StreamListener): 
>> def on_status(self, status): 
>> try: 
>> print "%s\t%s\t%s\t%s" % (status.text, 
>>   status.author.screen_name, 
>>   status.created_at, 
>>   status.source,) 
>> cur.execute("INSERT INTO tweets VALUES (%s, %s, %s, %s)", 
>> (status.text, 
>>   
>> status.author.screen_name, 
>>   
>> status.created_at, 
>>   
>> status.source)) 
>> except Exception, e: 
>> print >> sys.stderr, 'Encountered Exception:', e 
>> pass 
>> def on_error(self, status_code): 
>> print >> sys.stderr, 'Encountered error with status code:', 
>> status_code 
>> return True 
>> def on_timeout(self): 
>> print >> sys.stderr, 'Timeout...' 
>> return True 
>> streaming_api=tweepy.streaming.Stream(auth, CustomStreamListener(), 
>> timeout=60) 
>> print >> sys.stderr, 'Filtering the public timeline for "%s"' % (' 
>> '.join(sys.argv[1:]),) 
>> streaming_api.filter(follow=[], track=Q) 
>> return 
>> render_to_response('tweet.html',context_instance=RequestContext(request)) 
>>
>> If I can do it like this, won’t there be any code in template? Or 
>> what’s the best way I can carry out this operation. I hope you get my 
>> point? 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/-/M4lYq8eObEQJ.
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 With Tweepy

2012-03-28 Thread Python_Junkie
Interesting question.

I would have to think about your larger question, but the smaller issue, is 
that you need to close the crsr and you need to commit, 

I would think that you would not want to make commit automatic, so that 
your code has a chance to do some error checking and perhaps roll back.



On Tuesday, March 27, 2012 3:59:28 AM UTC-4, coded kid wrote:
>
> Hi guys, I’m confused on how to make this work. I want to stream 
> user’s tweets in my django app using tweepy. I’ve written the 
> streaming code but the problem I’m facing is: should I paste the code 
> in views.py and input- return 
> render_to_response('tweet.html',context_instance=RequestContext(request)) 
> after writing the code. Just like this: 
>
>
> Q= sys.argv[1:] 
>
> db=MySQLdb.connect("localhost","","","Juzme") 
>
> auth=tweepy.OAuthHandler(consumer_key, consumer_secret) 
> auth.set_access_token(access_token, access_token_secret) 
>
> cur=db.cursor() 
>
> class CustomStreamListener(tweepy.StreamListener): 
> def on_status(self, status): 
> try: 
> print "%s\t%s\t%s\t%s" % (status.text, 
>   status.author.screen_name, 
>   status.created_at, 
>   status.source,) 
> cur.execute("INSERT INTO tweets VALUES (%s, %s, %s, %s)", 
> (status.text, 
>   
> status.author.screen_name, 
>   
> status.created_at, 
>   
> status.source)) 
> except Exception, e: 
> print >> sys.stderr, 'Encountered Exception:', e 
> pass 
> def on_error(self, status_code): 
> print >> sys.stderr, 'Encountered error with status code:', 
> status_code 
> return True 
> def on_timeout(self): 
> print >> sys.stderr, 'Timeout...' 
> return True 
> streaming_api=tweepy.streaming.Stream(auth, CustomStreamListener(), 
> timeout=60) 
> print >> sys.stderr, 'Filtering the public timeline for "%s"' % (' 
> '.join(sys.argv[1:]),) 
> streaming_api.filter(follow=[], track=Q) 
> return 
> render_to_response('tweet.html',context_instance=RequestContext(request)) 
>
> If I can do it like this, won’t there be any code in template? Or 
> what’s the best way I can carry out this operation. I hope you get my 
> point? 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/-/ayxpyVfTYB4J.
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: Creating pdf files

2012-03-25 Thread Python_Junkie
I see from your link that there are 2 possible downloads to enable you to 
install the software that you want.

If you are having issues with the windows 2.7 exe, just use the zip file.

Then you can install the software by executing the following command after 
unzipping the file in windows.

c>  cd into the directory that contains the setup.py file

Then explicity install the software with python version2.7

c:\directory_where_setup_file_lives> c:\python27\python.exe setup.py install

Good luck



On Sunday, March 25, 2012 9:48:04 AM UTC-4, NENAD CIKIC wrote:
>
> Hello! 
> I am novice django user, and now i want to create pdf documents. 
> Following the official docs at 
> https://docs.djangoproject.​com/en/dev/howto/outputting-​pdf/
>  
> it seems the reportlab is suggested to be used. 
> The problem is that the installer does not work for python 2.7.2, for 
> windows. I have succesfully installed the reportlab on my ubuntu 
> virtualbox, but if it is possible i would like to continue development 
> on windows. 
> Are there any way to install reportlab on windows? 
> On the same page other options are listed: 
> pdflib 
> pisa 
>
> On pip there is a pypdflib. Is this the same as pdflib? 
>
> In anycase, what is the suggested way to generate simple pdf files 
> (invoices with a logo and some text). Any example? 
>
> Thanks 
> Nenad 
>

-- 
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/-/_YnzniDvkzAJ.
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 Detect Current Page as Homepage?

2012-03-25 Thread Python_Junkie

You can retrieve the url variable that you are interested in with 
evaluating this variable
request.path

Use this link for more details

http://www.djangobook.com/en/2.0/chapter07/

This is an example from the above source

def current_url_view_good(request):
return HttpResponse("Welcome to the page at %s" % request.path)




On Sunday, March 25, 2012 3:49:33 AM UTC-4, Kev Dwyer wrote:
>
> easypie wrote:
>
> > I'm trying to check {% if homepage %} then show  {% endif %}
> > 
> > I'm not sure how to go about a test to check the current page if it's my
> > homepage. Do I need to mess around with context processors? What's the
> > usual way of doing it? And how would the {% if ... %} look like?
> > 
>
> Assuming your home is named "home" in your urls.py, you could try:
>
> {% url home as home %}
>
> {% if request.path == home %}{% endif %}
>
>

-- 
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/-/gXYW34-7QAoJ.
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: Creating pdf files

2012-03-25 Thread Python_Junkie
Did you use the windows exe to install or did you use the zip file.

The zip file should work with any python installation

after unzipping the files, cd into the directory that included the setup.py 
file.

then use the following command line

explicitly use python27

cd into the unzipped directory

c:\some_unzip_directory>  c:\python27\python.exe  setup.py install

Good luck

On Sunday, March 25, 2012 9:48:04 AM UTC-4, NENAD CIKIC wrote:
>
> Hello! 
> I am novice django user, and now i want to create pdf documents. 
> Following the official docs at 
> https://docs.djangoproject.​com/en/dev/howto/outputting-​pdf/
>  
> it seems the reportlab is suggested to be used. 
> The problem is that the installer does not work for python 2.7.2, for 
> windows. I have succesfully installed the reportlab on my ubuntu 
> virtualbox, but if it is possible i would like to continue development 
> on windows. 
> Are there any way to install reportlab on windows? 
> On the same page other options are listed: 
> pdflib 
> pisa 
>
> On pip there is a pypdflib. Is this the same as pdflib? 
>
> In anycase, what is the suggested way to generate simple pdf files 
> (invoices with a logo and some text). Any example? 
>
> Thanks 
> Nenad 
>

-- 
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/-/dQjZMSoyMWEJ.
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: [bump] Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Python_Junkie
Use straight sql.

There are always potentially limitations with an abstraction such as the 
ORM.

Why try to fit a square peg into a round whole.

On Wednesday, March 21, 2012 4:41:32 AM UTC-4, diafygi wrote:
>
> There is an old thread that didn't end in a resolution about 
> preventing joins in a filter(foreign_key=None) scenario. 
>
>
> http://groups.google.com/group/django-users/browse_thread/thread/61ee2fb22deae326
>  
>
> I'd like to bring it up again and ask if there is now a way to prevent 
> joins from a query. 
>
> An example: 
> class Blog(model.Models): 
>editor = models.ForeignKey(User, null=True) 
>
> # find all the blogs with no editors 
> >>> Blog.objects.filter(editor=None) 
> DEBUG:django.db.backends:(0.039) SELECT `myapp_blog`.`id` FROM 
> `myapp_blog` LEFT OUTER JOIN `myapp_user` ON (`myapp_blog`.`editor_id` 
> = `myapp_user`.`id`) WHERE `myapp_user`.`id` IS NULL; 
>
> # Is there a way to do this query? 
> >>> Blog.objects.filter(editor=None) 
> DEBUG:django.db.backends:(0.039) SELECT `myapp_blog`.`id` FROM 
> `myapp_blog` WHERE `myapp_blog`.`editor_id` IS NULL; 
>
> Thanks! 
> Daniel

-- 
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/-/NfvXnYxnHBkJ.
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: create model on multiples schemas of database

2012-03-08 Thread Python_Junkie

That is a very interesting question.

I presume that you will not be doing this dynamically as a user logs on.

If that is the case, why don't you let django answer the question for you.

Create a database with the several different schemas and follow the 
instructions to let django create your model.

https://docs.djangoproject.com/en/dev/howto/legacy-databases/?from=olddocs

python manage.py inspectdb

Save this as a file by using standard Unix output redirection:

python manage.py inspectdb > models.py


I will try this myself to see if it works.


On Thursday, March 8, 2012 6:10:36 PM UTC-5, Moisés P. Sena wrote:
>
> Good night!
>
> I need to create the "DDL" a model in several DB schemas, not only in the 
> "public". The names of these schemas is "username" user logged.
>
> I'm using PostgreSQL.
>
> My model:
>
> class Empresa(models.Model):
> '''
> classdocs
> '''
> cnpj = models.CharField(max_length=14, blank=False, null=False, 
> unique=True,help_text=_("Required. 14 caracterss. Some numbers."))
> nome = models.CharField(max_length=255, blank=False, null=False)
> uf = models.ForeignKey(Uf, on_delete=models.PROTECT, blank=False, 
> null=False)
>
> def __unicode__(self):
> return self.nome + " (" + self.cnpj + ")"
>
> 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/-/ylZWHoGyeYoJ.
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: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-03-01 Thread Python_Junkie


On Wednesday, February 29, 2012 2:46:11 PM UTC-5, Django_for_SB wrote:
>
> Hello All, 
>
> I'm going through the tutorial on djangoproject.com, and can't seem to 
> hurdle over this section that reads "Write views that actually do 
> something" 
>
> Here's the code I have so far, which is directly copied from the 
> tutorial or prescribed by the tutorial: 
>
> views.py: 
> "from django.template import Context, loader 
> from polls.models import Poll 
> from django.http import HttpResponse 
>
> def index(request): 
> latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] 
> t = loader.get_template('polls/index.html') 
> c = Context({ 
> 'latest_poll_list': latest_poll_list, 
> }) 
> return HttpResponse(t.render(c))" 
>
>
>
> settings.py: 
> "... 
> TEMPLATE_DIRS = ( 
> # Put strings here, like "/home/html/django_templates" or "C:/www/ 
> django/templates". 
> # Always use forward slashes, even on Windows. 
> # Don't forget to use absolute paths, not relative paths. 
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/ 
> base_site.html' 
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/ 
> index.html' 
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/ 
> index.html' 
> ) 
> ..." 
>
>
> index.html: 
> "{% if latest_poll_list %} 
>  
> {% for poll in latest_poll_list %} 
> {{ poll.question }} li> 
> {% endfor %} 
>  
> {% else %} 
> No polls are available. 
> {% endif %} 
> " 
>
>
>
>
> I keep getting the same error, which reads: 
>
>
> TemplateDoesNotExist at /polls/ 
>
> polls/index.html 
>
> Request Method: GET 
> Request URL: http://localhost:8000/polls/ 
> Django Version: 1.3.1 
> Exception Type: TemplateDoesNotExist 
> Exception Value: 
>
> polls/index.html 
>
> Exception Location: C:\Python27\lib\site-packages\django\template 
> \loader.py in find_template, line 138 
> Python Executable: C:\Python27\python.exe 
> Python Version: 2.7.2 
> Python Path: 
>
> ['C:\\Python27\\my_Djando_projects\\mysite', 
>  'C:\\Windows\\system32\\python27.zip', 
>  'C:\\Python27\\DLLs', 
>  'C:\\Python27\\lib', 
>  'C:\\Python27\\lib\\plat-win', 
>  'C:\\Python27\\lib\\lib-tk', 
>  'C:\\Python27', 
>  'C:\\Python27\\lib\\site-packages'] 
>
> Server time: Wed, 29 Feb 2012 11:32:54 -0800 
> Template-loader postmortem 
>
> Django tried loading these templates, in this order: 
>
> Using loader django.template.loaders.filesystem.Loader: 
> c:\python27\my_djando_projects\mysite\my_templates\admin 
> \base_site.html 
> c:\python27\my_djando_projects\mysite\my_templates\admin\index.html 
> c:\python27\my_djando_projects\mysite\my_templates\polls\index.html 
> \polls\index.html (File does not exist) 
> Using loader django.template.loaders.app_directories.Loader: 
> c:\python27\lib\site-packages\django\contrib\admin\templates\polls 
> \index.html (File does not exist) 
>
>
>
>
> What on earth am I doing wrong here? I've so many different variations 
> of my settings.py, views.py, and index.html. Any help would be much 
> appreciated. 
>
>
> Thanks, 
>
> SB 
>
>

-- 
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/-/klXbEFxYWH4J.
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: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-03-01 Thread Python_Junkie
Just to get you past the error and display your data, I suggest hard coding 
the directory path in your view.
The work your way backwards to the settings file


try 

t = 
loader.get_template('C:\\Python27\\my_Djando_projects\\mysite\\My_Templates\\polls\\index.html'')
 


You could also add a little bit of python into your view to list the 
directory and print out the variable in the template just for a sanity check

path=C:\\Python27\\my_Djando_projects\\mysite\\My_Templates\\polls\\'
var=os.lisdir(path)

 c = Context({
   'latest_poll_list': latest_poll_list,"var":var,
   })

and then add the dictionary value {{var}} in your template


On Wednesday, February 29, 2012 2:48:53 PM UTC-5, atm wrote:
>
> You have to give template directories, not template names in the 
> settings.py.
> Thanks,
> Anoop
> atm
> ___
> Life is short, Live it hard.
>
>
>
>
> On 1 March 2012 01:16, Django_for_SB  wrote:
>
>> Hello All,
>>
>> I'm going through the tutorial on djangoproject.com, and can't seem to
>> hurdle over this section that reads "Write views that actually do
>> something"
>>
>> Here's the code I have so far, which is directly copied from the
>> tutorial or prescribed by the tutorial:
>>
>> views.py:
>> "from django.template import Context, loader
>> from polls.models import Poll
>> from django.http import HttpResponse
>>
>> def index(request):
>>latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>>t = loader.get_template('polls/index.html')
>>c = Context({
>>'latest_poll_list': latest_poll_list,
>>})
>>return HttpResponse(t.render(c))"
>>
>>
>>
>> settings.py:
>> "...
>> TEMPLATE_DIRS = (
>># Put strings here, like "/home/html/django_templates" or "C:/www/
>> django/templates".
>># Always use forward slashes, even on Windows.
>># Don't forget to use absolute paths, not relative paths.
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>> base_site.html'
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>> index.html'
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/
>> index.html'
>> )
>> ..."
>>
>>
>> index.html:
>> "{% if latest_poll_list %}
>>
>>{% for poll in latest_poll_list %}
>>{{ poll.question }}> li>
>>{% endfor %}
>>
>> {% else %}
>>No polls are available.
>> {% endif %}
>> "
>>
>>
>>
>>
>> I keep getting the same error, which reads:
>>
>>
>> TemplateDoesNotExist at /polls/
>>
>> polls/index.html
>>
>> Request Method: GET
>> Request URL:http://localhost:8000/polls/
>> Django Version: 1.3.1
>> Exception Type: TemplateDoesNotExist
>> Exception Value:
>>
>> polls/index.html
>>
>> Exception Location: C:\Python27\lib\site-packages\django\template
>> \loader.py in find_template, line 138
>> Python Executable:  C:\Python27\python.exe
>> Python Version: 2.7.2
>> Python Path:
>>
>> ['C:\\Python27\\my_Djando_projects\\mysite',
>>  'C:\\Windows\\system32\\python27.zip',
>>  'C:\\Python27\\DLLs',
>>  'C:\\Python27\\lib',
>>  'C:\\Python27\\lib\\plat-win',
>>  'C:\\Python27\\lib\\lib-tk',
>>  'C:\\Python27',
>>  'C:\\Python27\\lib\\site-packages']
>>
>> Server time:Wed, 29 Feb 2012 11:32:54 -0800
>> Template-loader postmortem
>>
>> Django tried loading these templates, in this order:
>>
>> Using loader django.template.loaders.filesystem.Loader:
>> c:\python27\my_djando_projects\mysite\my_templates\admin
>> \base_site.html
>> c:\python27\my_djando_projects\mysite\my_templates\admin\index.html
>> c:\python27\my_djando_projects\mysite\my_templates\polls\index.html
>> \polls\index.html (File does not exist)
>> Using loader django.template.loaders.app_directories.Loader:
>> c:\python27\lib\site-packages\django\contrib\admin\templates\polls
>> \index.html (File does not exist)
>>
>>
>>
>>
>> What on earth am I doing wrong here? I've so many different variations
>> of my settings.py, views.py, and index.html. Any help would be much
>> appreciated.
>>
>>
>> Thanks,
>>
>> SB
>>
>> --
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/7pKyULz9dxYJ.
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: Creating a hospital erp (hospital management) in Django

2012-02-13 Thread Python_Junkie
Now that you have your file >>models.py  >>>> place this file in the
app folder after creating your app

1.  python manage.py start app  My_Erp (for example)
2.  a blank models.py file will be created, overwrite this with your
models.py
3. run the command to sync the database, assuming that your set up the
settings.py file has been set up correctly to connect to the database
of your choice.

python manage.py syncdb

Let me know if this works for you









On Feb 13, 3:56 pm, Saadat  wrote:
> Thank you Python_junkie
> I've created the poll app and I'm working on this Hospital ERP thing.
> I've also created the database schema and put some dummy values for
> testing. Then I created the models using 'inspected' command and saved
> the models in models.py file. Now I'm confused where to put the
> models.py file and what to with it. Guide me please.
>
> Thanks a lot.
> Saadat
>
> On Feb 10, 6:18 pm, Python_Junkie 
> wrote:
>
>
>
>
>
>
>
> > Not sure from your post, which piece you are stuck on.
>
> > 1. Have you used Django before?
> > If not start with the tutorial
>
> >https://www.djangoproject.com/
>
> > 2. If you have a basic understanding of Django, have you been able to
> > set up a basic project /app and connect run syncdb.
> > One can always connect to the sqllite database, because it is built
> > in, but getting some other database to connect can be a time consuming
> > process if the procedure has not been established on your machine.
>
> > 3. If you have done the above 2 items then you should move in a
> > parallel path.
>
> > a. Start defining your database model to support the business and the
> > workflow that you intend to create.
> > b. Use some sort of wire frame (framework) to lay out your web pages
> > to support and interact step 3 a.
>
> > On Feb 10, 8:06 am, adesantoas...@gmail.com wrote:
>
> > > Hello, nice thread.
>
> > > **tagged to keep following..
>
> > > +adesst
>
> > > -Original Message-
> > > From: Saadat 
>
> > > Sender: django-users@googlegroups.com
> > > Date: Fri, 10 Feb 2012 02:58:16
> > > To: Django users
> > > Reply-To: django-users@googlegroups.com
> > > Subject: Creating a hospital erp (hospital management) in Django
>
> > > Hello All,
> > > I'm in my final year of computer science engineering and for my final
> > > year project, i'm creating a hospital erp. I'm a bit confused about
> > > where to start from. Any sort of help will be appreciated. Thanks a
> > > lot.
>
> > > Cheers
> > > Saadat
>
> > > --
> > > 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: Generating a list of available templates

2012-02-10 Thread Python_Junkie
I think I just figured out what you want to do.

You want one drop down list with all of the templates listed
regardless of which folder the template lives in.

So, as describe above you would create a dictionary of template_names
by walking through the directories where the templates live
and pass the dictionary back to the drop down list.

Once the template is selected then you have to render back to the
folder that the selected template lives in.

You can create a database table with 2 columns , assuming all of the
templates are named uniquely.

column a contains the nameof all of the templates from the drop down
list.
column b contains the path that the template lives in.

So, when  the user selects the template, the template value is passed
to the view.

The view can then perform a sql query

select template_path from table where template ='template_name'

value=crsr.fetchone()

full_path=value+template_name

render(full_path,  plus whatever values you want to pass that
template)


If you don't want to use a table you could have python walk through
all of the directories until it achieves a match on the template name

I hope this solves your question




On Feb 10, 4:33 pm, Python_Junkie 
wrote:
> I think you have it with the syntax you just wrote down.
>
> I will be available by phone until 4:45 if you want to call.
>
> 781-248-6557
>
> On Feb 10, 4:19 pm, Patrick Wellever  wrote:
>
>
>
>
>
>
>
> > Sorry, this question is turning out to be much more difficult to articulate
> > than I originally expected. Thanks for bearing with me. ;)
>
> > You definitely have the right idea of what I'm trying to do -- the only
> > problem with this method is that Django looks for templates in multiple
> > places, so I don't actually know the absolute path to the directory the
> > templates are in. You quoted the critical bit from the docs in your earlier
> > message: if 'django.template.loaders.app_directories.Loader' is included in
> > your TEMPLATE_LOADERS setting, Django will search for a directory called
> > 'templates' in each installed app, *in addition to all the directories
> > specified in TEMPLATE_DIRS*, when trying to load a template.
>
> > So if I have an app called 'myapp' and my settings.py contains this:
>
> > TEMPLATE_DIRS = ('/home/django/templates',)
>
> > TEMPLATE_LOADERS = (
> >     'django.template.loaders.filesystem.Loader',
> >     'django.template.loaders.app_directories.Loader',
> > )
>
> > ... then both "/home/django/templates/myapp/" and
> > "/path/to/myapp/templates/myapp/" are legitimate places to stick the
> > templates for the app. I'm trying to find a solution that would list the
> > contents of my specified directory in either of these locations.
>
> > I need something like:
>
> > template_files = []
> > for dir in EVERY_DIRECTORY_DJANGO_LOOKS_FOR_TEMPLATES_IN:
> >     template_files.extend(os.listdir(dir))
>
> > I have to agree about the spoken word, though... Happy to discuss this by
> > phone if you'd like, and thanks again for your help.
>
> > - Patrick
>
> > On Fri, Feb 10, 2012 at 3:25 PM, Python_Junkie <
>
> > software.buy.des...@gmail.com> wrote:
> > > The internet is a wonderful invention, but sometimes the interchange
> > > of the spoken word is more efficient.
>
> > > Let's see if I have this straight.
>
> > > You know which directory the templates are in.
>
> > > 'templates/flatpages/page_templates/   for example.
> > > Is that correct?
>
> > > Then when you pass from the url.py to the specific view that you are
> > > directed to by the url  you simply call the function
> > > *
> > > files=os.listdir('templates/flatpages/page_templates/ ')
>
> > > template_qty=len(files)
>
> > > for xxx in range(template_qty):
> > >             #perform the logic to add values to the dictionary
> > >           template_dictionary=(  a:'a',b:'b')     ### I forget the
> > > exact syntax
>
> > > render(form_template_listing.html,template_dictionary)    -  ## I
> > > forget the exact syntax
>
> > > **
>
> > > Then in the form_template_listing.html  , template unpack the template
> > > dictionary in the drop down list.
>
> > > I believe this is what you are asking.
>
> > > If not I can send you my cell phone number and we can discuss 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: Generating a list of available templates

2012-02-10 Thread Python_Junkie
I think you have it with the syntax you just wrote down.

I will be available by phone until 4:45 if you want to call.

781-248-6557

On Feb 10, 4:19 pm, Patrick Wellever  wrote:
> Sorry, this question is turning out to be much more difficult to articulate
> than I originally expected. Thanks for bearing with me. ;)
>
> You definitely have the right idea of what I'm trying to do -- the only
> problem with this method is that Django looks for templates in multiple
> places, so I don't actually know the absolute path to the directory the
> templates are in. You quoted the critical bit from the docs in your earlier
> message: if 'django.template.loaders.app_directories.Loader' is included in
> your TEMPLATE_LOADERS setting, Django will search for a directory called
> 'templates' in each installed app, *in addition to all the directories
> specified in TEMPLATE_DIRS*, when trying to load a template.
>
> So if I have an app called 'myapp' and my settings.py contains this:
>
> TEMPLATE_DIRS = ('/home/django/templates',)
>
> TEMPLATE_LOADERS = (
>     'django.template.loaders.filesystem.Loader',
>     'django.template.loaders.app_directories.Loader',
> )
>
> ... then both "/home/django/templates/myapp/" and
> "/path/to/myapp/templates/myapp/" are legitimate places to stick the
> templates for the app. I'm trying to find a solution that would list the
> contents of my specified directory in either of these locations.
>
> I need something like:
>
> template_files = []
> for dir in EVERY_DIRECTORY_DJANGO_LOOKS_FOR_TEMPLATES_IN:
>     template_files.extend(os.listdir(dir))
>
> I have to agree about the spoken word, though... Happy to discuss this by
> phone if you'd like, and thanks again for your help.
>
> - Patrick
>
> On Fri, Feb 10, 2012 at 3:25 PM, Python_Junkie <
>
>
>
>
>
>
>
> software.buy.des...@gmail.com> wrote:
> > The internet is a wonderful invention, but sometimes the interchange
> > of the spoken word is more efficient.
>
> > Let's see if I have this straight.
>
> > You know which directory the templates are in.
>
> > 'templates/flatpages/page_templates/   for example.
> > Is that correct?
>
> > Then when you pass from the url.py to the specific view that you are
> > directed to by the url  you simply call the function
> > *
> > files=os.listdir('templates/flatpages/page_templates/ ')
>
> > template_qty=len(files)
>
> > for xxx in range(template_qty):
> >             #perform the logic to add values to the dictionary
> >           template_dictionary=(  a:'a',b:'b')     ### I forget the
> > exact syntax
>
> > render(form_template_listing.html,template_dictionary)    -  ## I
> > forget the exact syntax
>
> > **
>
> > Then in the form_template_listing.html  , template unpack the template
> > dictionary in the drop down list.
>
> > I believe this is what you are asking.
>
> > If not I can send you my cell phone number and we can discuss 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: Generating a list of available templates

2012-02-10 Thread Python_Junkie
The internet is a wonderful invention, but sometimes the interchange
of the spoken word is more efficient.

Let's see if I have this straight.

You know which directory the templates are in.

'templates/flatpages/page_templates/   for example.
Is that correct?

Then when you pass from the url.py to the specific view that you are
directed to by the url  you simply call the function
*
files=os.listdir('templates/flatpages/page_templates/ ')

template_qty=len(files)

for xxx in range(template_qty):
 #perform the logic to add values to the dictionary
   template_dictionary=(  a:'a',b:'b') ### I forget the
exact syntax

render(form_template_listing.html,template_dictionary)-  ## I
forget the exact syntax

**

Then in the form_template_listing.html  , template unpack the template
dictionary in the drop down list.




I believe this is what you are asking.

If not I can send you my cell phone number and we can discuss it.





On Feb 10, 3:01 pm, "Demetrio Girardi" 
wrote:
> On 10 Feb 2012 at 14:50, Patrick Wellever wrote:
>
> > I want to make it a choice field that justs lists all the files in, for 
> > example,
> > 'templates/flatpages/page_templates/', so the user can see what templates 
> > are available and just
> > choose one from a select list.
>
> you can read the filesystem in the form's (or form field's) __init__.

-- 
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: Generating a list of available templates

2012-02-10 Thread Python_Junkie
I am not sure that I follow you.

When you mention creating new templates (you would be creating these
dynamically?) and have them show up in your database (model?)

Please explain or provide an example



On Feb 10, 1:45 pm, Patrick Wellever  wrote:
> Right, I understand the loader works this way… What I'm trying to do is 
> generate a list of 'choices' for a model field that populates itself 
> automatically with available templates in a given directory, that works 
> regardless of whether the specified directory is on a template path specified 
> in the TEMPLATE_DIRS setting or a template path loaded by some loader other 
> than the filesystem loader.
>
> I want to scan a directory on the template path and return a list of all the 
> files in that directory, ideally by hooking into whatever functions Django 
> uses to locate templates, so that my list will populate correctly whether the 
> directory is on an app-specific template path or one explicitly defined in 
> the TEMPLATE_DIRS setting. Does that make sense? Point is I want to be able 
> to just create new template files in this particular directory and have them 
> automatically show up as available choices for a "template" field on my model.
>
>
>
>
>
>
>
> On Friday, February 10, 2012 at 1:33 PM, Python_Junkie wrote:
>
> >https://docs.djangoproject.com/en/dev/ref/templates/api/
>
> > Search on template loaders and this url will explain 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: Generating a list of available templates

2012-02-10 Thread Python_Junkie


https://docs.djangoproject.com/en/dev/ref/templates/api/

Search on template loaders and this url will explain it.





The following is from this url

django.template.loaders.app_directories.Loader

Loads templates from Django apps on the filesystem. For each app
in INSTALLED_APPS, the loader looks for a templates subdirectory. If
the directory exists, Django looks for templates in there.

This means you can store templates with your individual apps. This
also makes it easy to distribute Django apps with default templates.

For example, for this setting:

INSTALLED_APPS = ('myproject.polls', 'myproject.music')

...then get_template('foo.html') will look for templates in these
directories, in this order:

/path/to/myproject/polls/templates/foo.html
/path/to/myproject/music/templates/foo.html

Note that the loader performs an optimization when it is first
imported: It caches a list of which INSTALLED_APPS packages have a
templates subdirectory.

This loader is enabled by default.



On Feb 10, 1:21 pm, Patrick Wellever  wrote:
> Thanks, I think that gets me most of the way there, but the part I'm having 
> more trouble with is figuring out how to deal with the other template 
> loaders, such as 'django.template.loaders.app_directories.Loader', that don't 
> pull from the 'TEMPLATE_DIRS' setting. I'd like the solution to take those 
> into account if possible.
>
> Is there any way to iterate over whatever list of source directories Django 
> builds when it wants to go looking for a template?
>
> Thanks,
> Patrick
>
>
>
>
>
>
>
> On Friday, February 10, 2012 at 1:03 PM, Python_Junkie wrote:
> > The setttings file is a python module.
>
> > See page
> >https://docs.djangoproject.com/en/dev/topics/settings/
>
> > Since the path is set for the templates.
> > ***
> > frrom the example
>
> > TEMPLATE_DIRS = ('/home/templates/mike')
>
> > in the view
>
> > templates=os.listdir(TEMPLATE_DIRS)
> > ###template_count=len(templates)
>
> > create a dictionary of templates and pass it back to the rendered
> > template and you have 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: Generating a list of available templates

2012-02-10 Thread Python_Junkie
The setttings file is a python module.

See page
https://docs.djangoproject.com/en/dev/topics/settings/

Since the path is set for the templates.
***
frrom the example

TEMPLATE_DIRS = ('/home/templates/mike')

in the view

templates=os.listdir(TEMPLATE_DIRS)
###template_count=len(templates)

create a  dictionary of templates and pass it back to the rendered
template and you have it.





On Feb 10, 12:42 pm, Micky Hulse  wrote:
> On Fri, Feb 10, 2012 at 6:40 AM, Patrick Wellever  wrote:
> > I guess the main question is, is there some function I can use to return a
> > directory on the template path?
>
> I'm interested in this also.
>
> I too have my own static pages app and have always thought it would be
> easier for folks to choose from a list of files rather than have to
> remember what's there on the file system.
>
> I suppose one way to do it would be to create an FK to another model
> what someone has entered the paths to available templates... But, I do
> like the idea of reading the contents of a folder and having a
> dropdown that updates dynamically (with code portability in mind).
>
> Patrick, if you find a solution please post it back here to the list.
> I will do the same.
>
> Thanks!
> M

-- 
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: Creating a hospital erp (hospital management) in Django

2012-02-10 Thread Python_Junkie
Is the project referenced in this link written in Django.

Was your goal for your class project to write a Django app?



On Feb 10, 8:27 am, Richard House  wrote:
> Hi Saadat,
> Rather than creating something new, have you looked at contributing to 
> software from such lists like 
> this?http://en.wikipedia.org/wiki/List_of_open-source_healthcare_software
>
> Regards,
> Richard
>
> On 10 Feb 12, at 10:58, Saadat wrote:
>
>
>
>
>
>
>
> > Hello All,
> > I'm in my final year of computer science engineering and for my final
> > year project, i'm creating a hospital erp. I'm a bit confused about
> > where to start from. Any sort of help will be appreciated. Thanks a
> > lot.
>
> > Cheers
> > Saadat
>
> > --
> > 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: Creating a hospital erp (hospital management) in Django

2012-02-10 Thread Python_Junkie
I had not completed my previous post, and hit the send button by
mistake.

One wire frame work is
http://www.balsamiq.com/products/mockups/manifesto

And you can download a free trial.

If you search on Frameworks then you will find a number of others that
are open source, or you can simply use yellow stickies, as some of
these web sites suggest as an alternative.

Then convert the yellow stickies into web pages and link them to the
backend database.

Good luck


On Feb 10, 8:18 am, Python_Junkie 
wrote:
> Not sure from your post, which piece you are stuck on.
>
> 1. Have you used Django before?
> If not start with the tutorial
>
> https://www.djangoproject.com/
>
> 2. If you have a basic understanding of Django, have you been able to
> set up a basic project /app and connect run syncdb.
> One can always connect to the sqllite database, because it is built
> in, but getting some other database to connect can be a time consuming
> process if the procedure has not been established on your machine.
>
> 3. If you have done the above 2 items then you should move in a
> parallel path.
>
> a. Start defining your database model to support the business and the
> workflow that you intend to create.
> b. Use some sort of wire frame (framework) to lay out your web pages
> to support and interact step 3 a.
>
> On Feb 10, 8:06 am, adesantoas...@gmail.com wrote:
>
>
>
>
>
>
>
> > Hello, nice thread.
>
> > **tagged to keep following..
>
> > +adesst
>
> > -Original Message-
> > From: Saadat 
>
> > Sender: django-users@googlegroups.com
> > Date: Fri, 10 Feb 2012 02:58:16
> > To: Django users
> > Reply-To: django-users@googlegroups.com
> > Subject: Creating a hospital erp (hospital management) in Django
>
> > Hello All,
> > I'm in my final year of computer science engineering and for my final
> > year project, i'm creating a hospital erp. I'm a bit confused about
> > where to start from. Any sort of help will be appreciated. Thanks a
> > lot.
>
> > Cheers
> > Saadat
>
> > --
> > 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: Creating a hospital erp (hospital management) in Django

2012-02-10 Thread Python_Junkie
Not sure from your post, which piece you are stuck on.

1. Have you used Django before?
If not start with the tutorial

https://www.djangoproject.com/

2. If you have a basic understanding of Django, have you been able to
set up a basic project /app and connect run syncdb.
One can always connect to the sqllite database, because it is built
in, but getting some other database to connect can be a time consuming
process if the procedure has not been established on your machine.

3. If you have done the above 2 items then you should move in a
parallel path.

a. Start defining your database model to support the business and the
workflow that you intend to create.
b. Use some sort of wire frame (framework) to lay out your web pages
to support and interact step 3 a.



On Feb 10, 8:06 am, adesantoas...@gmail.com wrote:
> Hello, nice thread.
>
> **tagged to keep following..
>
> +adesst
>
>
>
>
>
>
>
> -Original Message-
> From: Saadat 
>
> Sender: django-users@googlegroups.com
> Date: Fri, 10 Feb 2012 02:58:16
> To: Django users
> Reply-To: django-users@googlegroups.com
> Subject: Creating a hospital erp (hospital management) in Django
>
> Hello All,
> I'm in my final year of computer science engineering and for my final
> year project, i'm creating a hospital erp. I'm a bit confused about
> where to start from. Any sort of help will be appreciated. Thanks a
> lot.
>
> Cheers
> Saadat
>
> --
> 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: regarding an error in settings.py

2012-02-10 Thread Python_Junkie
The name field is the database name.

You always need to create an empty database for any new
implementation.

Have you created a database and can you attach to it with the
credentials that are supplied in the settings.py file

On Feb 10, 6:35 am, Stanwin Siow  wrote:
> can you show the actual error output?
>
> Best Regards,
>
> Stanwin Siow
>
> On Feb 10, 2012, at 4:58 PM, kalyani ram wrote:
>
>
>
>
>
>
>
> > Thank you very much. I managed to come out of this error and ended up
> > with a new one.
> > I get an error saying that the Name field is wrong. If i have not
> > mistaken, should the name filed be the table name ? or is it something
> > new?
> > thanks in advance.
>
> > On Feb 9, 7:30 pm, Stanwin Siow  wrote:
> >> Hi
>
> >> You need to install the package psycopg2. Google  and install the package.
>
> >> It should work
>
> >> Best Regards,
>
> >> Stanwin Siow
>
> >> On Feb 9, 2012, at 10:10 PM, kalyani ram wrote:
>
> >>> Hey all,
> >>> Tday is my first day with django and i tried configuring postgresql as
> >>> a backend and got an error like this:
>
> >>> raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
> >>> django.core.exceptions.ImproperlyConfigured: Error loading psycopg2
> >>> module: No module named psycopg2
>
> >>> Please help me. 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 
> >>> 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.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: Is it possible to implement an ODBC for Django

2012-02-10 Thread Python_Junkie
Thanks for your response, but that was not exactly what I was looking
for.

I use pyodbc module for all of my sql connections through python in
general.
It is very powerful.
But it does not allow me to configure the settings.py file for an ODBC
connection

I wanted to how I would implement ODBC through the settings.py file.

I have been unable to implement a MYSQL / python module on Mac OS Lion

I really do  not want this post to be explanations of how to install
MYSQL
I have spent enough time failing in that route.

I would like to know if anyone has had success
1. setting up an ODBC connection - I have done that on Lion and can
connect successfully through pyodbc module to the database
2. Configure the settings.py file for the ODBC connection that I have
set up successfully.

Thanks in advance.




On Feb 10, 4:00 am, Renne Rocha  wrote:
>   Try:
>
>  http://pyodbc.sourceforge.net/andhttp://code.google.com/p/django-pyodbc/
>
>   Renne Rocha
>  http://rennerocha.com/
>
> On Fri, Feb 10, 2012 at 1:29 AM, Python_Junkie <
>
>
>
>
>
>
>
> software.buy.des...@gmail.com> wrote:
> > I wanted to know if the settings.py will support a generic ODBC
> > connection and if it could what the syntax would be in the database
> > section of the , settings.py file
>
> > --
> > 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.



Is it possible to implement an ODBC for Django

2012-02-09 Thread Python_Junkie
I wanted to know if the settings.py will support a generic ODBC
connection and if it could what the syntax would be in the database
section of the , settings.py file

-- 
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: Entering Text into a Database

2012-02-02 Thread Python_Junkie
Not sure if this will help, but I have diverted from the standard
method of database updates taught in the tutorial.

I take a more traditional sql methodology

for example in any view that I am using.

I collect the data elements via a request
and then build a sql statement

for example

(The exact syntax may be a little off.)

var_1=request.post(name)

var_2=...etc

insert into table 1(col_1,col_2) values ('var_1,var_2)

commit


Let me know if this helps and I can update the syntax to be more
precise.

On Feb 2, 9:51 pm, ajohnston  wrote:
> On Feb 2, 2:30 pm, ds39  wrote:
> Is there any page, outside of the
>
> > official documentation, that gives an example from beginning to end
> > regarding how to save ModelForms in your database using views.py
> > rather than the shell (including sample URLs) ? Also, how would I
> > access the entered text via the shell to determine if it was saved ?
>
> Did you do the tutorial[1]?. Be sure to do all four parts. After that
> the examples in the ModelForms documentation[2] should make sense. If
> not, ask specific questions about what is not working the way you
> think it should. Good luck.
>
> {1]https://docs.djangoproject.com/en/dev/intro/tutorial01/
> [2]https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/

-- 
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: mac vs windows installation /deployment

2012-01-16 Thread Python_Junkie
Thank you for your response.

Your answer makes sense.
If the source is set up as a package then  in theory it can be
installed on any platform
with the command setup.py install.

Thanks again.
I will try again to set finish the set up on my Mac.

Bob

On Jan 16, 11:38 am, Tom Evans  wrote:
> On Mon, Jan 16, 2012 at 4:32 PM, Python_Junkie
>
>  wrote:
> > Thanks for the procedure.
>
> > But when I look at the list of packages for pyodbc displayed, they are
> > tailored to a specific version of python /chipset.
>
> >http://code.google.com/p/pyodbc/downloads/list
>
> Note, these are not ports, but compiled packages.
>
>
>
> > I have a couple of questions.
>
> > 1. Where do I obtain the source code for pyodbc, above,
>
> So, eg from that list:
>
> http://code.google.com/p/pyodbc/downloads/detail?name=pyodbc-2.1.11.z...
>
> > 2. How do I tailor it for Lion OS and python 27 for example
>
> fetch the file above, unpack it
> open a terminal and cd to that location
> run ''sudo python setup.py install''
>
> > 3. How much testing do I need to do in order to make sure that it
> > works
>
> None/as much as you like. You aren't getting any guarantees with this
> code, if there are issues related to your specific choice of platform
> that other people haven't encountered, they will be unlikely to be
> fixed (self evidently).
>
>
>
> > The last item leads me to another question, if I see a port of this
> > package from the url above
> > How confident can I be that it has been tested thoroughly
>
> See above.
>
> 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: mac vs windows installation /deployment

2012-01-16 Thread Python_Junkie

>yes, this is wrong.  most development is done in non-windows OS.
>what you're seeing is that since OSS is about sharing source,
On Jan 16, 11:31 am, Javier Guerra Giraldez 
wrote:
> On Mon, Jan 16, 2012 at 11:22 AM, Python_Junkie
>

I guess I am digging in a lot deeper into this topic that I had
intended, but your statement above
about each developer compiling their own source code seems to go
against the DRY
principle.

I have no issue with running a script that will compile the source
code, if that was all there was to the process,
 but if someone has tweaked the source code
and makes it work on a particular version of mac OS or ubuntu with a
particular version of python, why do I want
to go through the same exercise and then recompile again.  It seems it
is not simply a matter of compiling the source code.

Thanks for your feedback,






>  wrote:
> > Am I wrong in the assumption that there are less python packages
> > available for non windows OS
>
> yes, this is wrong.  most development is done in non-windows OS.
>
> what you're seeing is that since OSS is about sharing source, the main
> form of distribution is source.  but some projects recognize that
> windows doesn't make it easy to compile, so they (or some
> side-project) keep binaries to help those users.
>
> it's a pity that MacOS is going the same route (i think 10.4 still
> included XCode in the optional installers DVD), so there's some demand
> for binary distribution for Mac too.
>
> --
> 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.



Re: mac vs windows installation /deployment

2012-01-16 Thread Python_Junkie
Thanks for the procedure.

But when I look at the list of packages for pyodbc displayed, they are
tailored to a specific version of python /chipset.

http://code.google.com/p/pyodbc/downloads/list

I have a couple of questions.

1. Where do I obtain the source code for pyodbc, above,
2. How do I tailor it for Lion OS and python 27 for example
3. How much testing do I need to do in order to make sure that it
works

The last item leads me to another question, if I see a port of this
package from the url above
How confident can I be that it has been tested thoroughly

Thanks

Bob

On Jan 16, 11:13 am, Brett Epps  wrote:
> You need two things:
>
> - Xcode (available in the Mac App Store) - this will give you the tools
> needed to build software from source
> - Homebrew (http://mxcl.github.com/homebrew/) - this is similar to fink or
> MacPorts, but IMHO much better
>
> Then do something like:
>
> > sudo easy_install pip
> > sudo pip install virtualenv
> > virtualenv /path/to/project/env
> > /path/to/project/env/bin/activate
> > pip install pyodbc mysqldb psycopg2
>
> And possibly:
>
> > brew install mysql postgresql
>
> All done!
>
> Brett
>
> On 1/15/12 11:27 PM, "Python_Junkie"  wrote:
>
>
>
>
>
>
>
> >I have been developing python/django programs on a windows machine at
> >work for several years
> >and have been very satisfied with the functionality available from the
> >available modules in windows.
>
> >I thought I would expand my universe and set up the development
> >environment on a mac this weekend at home.
>
> >I found some nice IDE's to use for developing on for the mac
>
> >and then I found this web site that seemed to have a thorough approach
> >to setting up the django environment
>
> >http://hackercodex.com/2011/08/30/python-install-django-on-mac-osx-li...
> >.7/
>
> >I was pretty satisfied with the core result.
>
> >I then wanted to add some extra modules that I have employed routinely
> >at work and ran into some difficulties.
>
> >I wanted to use pyodbc and mysql and postgre modules to implement
> >database functionality, as I do at my work.
>
> >I was either unable to find the mac versions, or the versions
> >available were source code that and not self installers that would
> >need to be compiled,
> >with the possibility, since they were not specifically made for Lion
> >that after compiling they would function correctly.
>
> >Just looking for feedback /input.  I would really like to use the mac
> >for development, because I like so many other web utilities on this
> >machine.
>
> >The solution I ended up with was using the mac  as my base machine in
> >order to use all of the utilities and simultaneously
> > logging in remotely to the windows machine for django development.
>
> >I don't want to start a border war, but does anyone have any
> >suggestions on setting up the mac development environment.
>
> >Just seemed like when I was looking for comparable modules, they were
> >not always readily available.
>
> >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.

-- 
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: mac vs windows installation /deployment

2012-01-16 Thread Python_Junkie
I appreciate your response.
I still would like to move my development over to linux based OS, as
you said many of the deployments are on linux web servers.

You helped me clarify what I would require in order to make any
project successful.
I would need the capability of porting any existing open source module
to the OS /python/django/version that I would be implementing.

For example the sql/odbc module pyodbc exists as shown on this link
http://code.google.com/p/pyodbc/downloads/list

Can someone provide some guidance as to how I would port the source
code to a package that I could ultimately install with the simple
command of setup.py install

for any development environment that I would require.

***

I realize that there is a procedure for packaging up the source code,
but then I have to test it and make any modifications for the
environment that I am porting it to.

Which variables are the ones that I have to be most concerned about
python version
django version
OS version

In the end I have to decide whether it is worth it to move to "a less
supported" OS, if I have to port multiple packages/modules

Am I wrong in the assumption that there are less python packages
available for non windows OS

Thanks


Bob




On Jan 16, 9:39 am, j_syk  wrote:
> This isn't really an answer to your question, but here's my 2 cents.
> I'm in the reverse situation as you, Macs at work and Windows at home.
> I wasn't too interested in figuring out Django development on either
> after quickly disliking macports and never having the desire to
> develop on windows without a specific IDE. Although at the time I
> tried both, I was probably just too overwhelmed with everything I need
> to try to learn.
>
> I have always used a linux environment (ubuntu), mostly though ssh on
> headless clients. For a while I was running ubuntu desktop and server
> editions though virtual machines on both my work mac and windows
> computer at home and using osx and windows as my workspace. But now I
> have dedicated Linux servers at work and home to develop on, and a
> linode slice for public websites. I guess I've gotten used to a
> terminal based approach and using FTP as necessary.
>
> I don't know what your plans are in the future, but a lot of web
> hosting servers are Linux, so it may be beneficial to have experience
> and/or be able to directly port over projects.
>
> I know you asked for A or B and I said C, but maybe think about 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.



mac vs windows installation /deployment

2012-01-15 Thread Python_Junkie
I have been developing python/django programs on a windows machine at
work for several years
and have been very satisfied with the functionality available from the
available modules in windows.

I thought I would expand my universe and set up the development
environment on a mac this weekend at home.

I found some nice IDE's to use for developing on for the mac

and then I found this web site that seemed to have a thorough approach
to setting up the django environment

http://hackercodex.com/2011/08/30/python-install-django-on-mac-osx-lion-10.7/

I was pretty satisfied with the core result.

I then wanted to add some extra modules that I have employed routinely
at work and ran into some difficulties.

I wanted to use pyodbc and mysql and postgre modules to implement
database functionality, as I do at my work.

I was either unable to find the mac versions, or the versions
available were source code that and not self installers that would
need to be compiled,
with the possibility, since they were not specifically made for Lion
that after compiling they would function correctly.


Just looking for feedback /input.  I would really like to use the mac
for development, because I like so many other web utilities on this
machine.

The solution I ended up with was using the mac  as my base machine in
order to use all of the utilities and simultaneously
 logging in remotely to the windows machine for django development.

I don't want to start a border war, but does anyone have any
suggestions on setting up the mac development environment.

Just seemed like when I was looking for comparable modules, they were
not always readily available.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help me with django Form

2012-01-13 Thread Python_Junkie
I believe you are mixing methods.

Django has built in generic views and generic forms for example.

But, you have used a template with standard (html) from syntax.

Since you are doing a post, request.

In your view just assign a variable to each variable in the form that
you are pulling back and then you can use those variables for the 2
functions that you wanted to achieve.

1. use the variables to insert a row into a database table
for example
names=request.names
etc

sql to insert into table
2. create a dcitionary to respond to the users request in the

[('names':names,   )]
 render_to_response('mainpage.html', dictionary values)


def welcome(request):
#Allow new user reg and login, if failed direct the user to
signup
if request.method=='POST':
form=models.Register()
new_user=form.save()
return HttpResponseRedirect('/logpage/')
else:
form=models.Register()
return render_to_response('mainpage.html',
{'form':models.Register})

On Jan 14, 12:13 am, coded kid  wrote:
> Thanks guys! @daniel I still don't get what django doc is trying to
> say about ModelForm. Can you please explain further?
>
> On Jan 12, 10:30 am, Daniel Roseman  wrote:
>
>
>
>
>
>
>
> > On Thursday, 12 January 2012 01:49:40 UTC, coded kid wrote:
>
> > > Hi guys, I’ve been trying to signup using the django form I created.
> > > Whenever I signup, the form is always saving the id no and not other
> > > fields like names, username.pasword,email etc. Below are the codes;
> > > In views.py:
> > > from django.shortcuts import render_to_response
> > > from django.http import HttpResponse
> > > from django.template import RequestContext
> > > from django.http import HttpResponseRedirect
> > > from mymeek.meekme import models
> > > from django.views.decorators.csrf import csrf_exempt
> > > @csrf_exempt
> > > def welcome(request):
> > >     #Allow new user reg and login, if failed direct the user to signup
> > >     if request.method=='POST':
> > >         form=models.Register()
> > >         new_user=form.save()
> > >         return HttpResponseRedirect('/logpage/')
> > >     else:
> > >         form=models.Register()
> > >         return render_to_response('mainpage.html',
> > > {'form':models.Register})
>
> > You haven't defined a form. Just calling a model instance "form" doesn't
> > make it one.
> > Plus, of course, at no point are you passing the POST values into the
> > instantiation.
> > Seehttps://docs.djangoproject.com/en/1.3/topics/forms/modelforms/for
> > modelforms,
> > andhttps://docs.djangoproject.com/en/1.3/topics/forms/#using-a-form-in-a...
> > for the general pattern of how to instantiate a form from the POST.
> > --
> > DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to avoid "no such column" error when I add a new property to a model?

2012-01-11 Thread Python_Junkie
For those who do not want to use another abstraction module, just use
sql on the database to add the column.

Look up the alter table command for the database that you are using.

On Jan 11, 5:26 am, callum  wrote:
> I created an "Article" model with a few simple properties. I ran
> syncdb, and set up the Django admin site, and added
> "admin.site.register(Article)" in admin.py. Using the Django admin
> site, I created an article by filling in the form.
>
> I then went into models.py and added another property. I ran syncdb
> again, ran the server again, then when I opened the Django admin site
> again, I got the "no such column" error.
>
> When I Googled this, the only obvious solutions I found were to reset
> the app, or at least drop the database table that changed, and start
> over.
>
> But how do I do this without losing my data?

-- 
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: Problem getting django on mac (10.5/Leopard) working

2012-01-08 Thread Python_Junkie
using the terminal window execute the following command for each and
every version of python that you might want to use.

cd into the folder that contains the setup.py file in django and run
the following command  >>/usr/local/bin/pythonw  setup.py install

and all of the components will be moved into the correct python
folders






On Jan 7, 9:13 pm, "larry.mart...@gmail.com" 
wrote:
> On Jan 7, 7:03 pm, David Markey  wrote:
>
> > Is there a reason you didnt do easy_install django?
>
> Cause I didn't know about it. I just followed the directions I found
> at:
>
> https://docs.djangoproject.com/en/dev/topics/install/
>
> Is there some reason that wouldn't work?
>
>
>
>
>
>
>
>
>
> > On 8 January 2012 01:50, larry.mart...@gmail.com 
> > wrote:
>
> > > I am trying to get django working on my mac. I downloaded it from SVN
> > > to /usr/local/django-trunk and it's there:
>
> > > $ ls /usr/local/django-trunk/
> > > __init__.py     core            http            templatetags bin
> > >      db              middleware      test
> > > conf                    dispatch        shortcuts       utils
> > >   contrib     forms
> > > template                views
>
> > > I updated my site-packages with a django.pth file:
>
> > > $ cat /Library/Python/2.5/site-packages/django.pth
> > > /usr/local/django-trunk
>
> > > python does have this dir in its path:
>
> > > $ python -c "import sys; print sys.path"
> > > ['', '/Library/Python/2.5/site-packages/cx_Oracle-5.0.2-py2.5-
> > > macosx-10.5-i386.egg', '/System/Library/Frameworks/Python.framework/
> > > Versions/2.5/lib/python25.zip', '/System/Library/Frameworks/
> > > Python.framework/Versions/2.5/lib/python2.5', '/System/Library/
> > > Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/
> > > System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.5/
> > > lib/python2.5/plat-mac/lib-scriptpackages', '/System/Library/
> > > Frameworks/Python.framework/Versions/2.5/Extras/lib/python', '/System/
> > > Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-
> > > tk', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/usr/
> > > local/django-trunk', '/System/Library/Frameworks/Python.framework/
> > > Versions/2.5/Extras/lib/python/PyObjC']
>
> > > But I still can't import it:
>
> > > $ python
> > > Python 2.5.1 (r251:54863, May  5 2011, 18:37:34)
> > > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> > > Type "help", "copyright", "credits" or "license" for more information.
> > > >>> import django
> > > Traceback (most recent call last):
> > >  File "", line 1, in 
> > > ImportError: No module named django
>
> > > What am I missing or doing wrong?
>
> > > TIA!
> > > -larry
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django/Data Base Advice

2012-01-03 Thread Python_Junkie

Don't want to confuse you on the database topic, but thought I would
add my 2 cents.

You asked how to go about learning how to design / utilize the
database within the context of django.

I just wanted to point out that the django tutorial will point you
down the road of implementing a database abstraction layer, the ORM.
With the object relational model (ORM), you can create tables and
relationships and extract or insert/update data from those tables.


The ORM is fine to work with, however, just be aware that reading up
on database tutorials, sql queries, table design, relational models
etc,
may confuse you a bit when trying to equate those concepts to the ORM.

My own preference is to use sql calls using python directly rather
than using the ORM in django.   Just another (abstraction) layer to
learn, and it is a matter
of opinion the value it adds to the speed, or efficiency of the
development process







On Jan 3, 4:09 am, wC  wrote:
> Chris,
>
> I think was somehow in the same stage not so long ago... Here is how I went
> about it:
>
> 1. I watched a db-class video from time to time (teaches you what joins are
> etcetera). Using the ORM without db knowledge is ok if efficiency is not
> your main concern. Sooner or later you have to make database design choices
> and only relying on the community is going to slow you down. Good advice is
> expensive (time or effort).
> 2. Having read the docs on djangoproject.com (which are huge), I read
> djangobook.com, then I started building my own apps following some of the
> tutorials fromhttps://code.djangoproject.com/wiki/Tutorials. I made myself
> a todo-app, for instance. There are about three or four tutorials for that
> and each of them adds some knowledge (the nettuts one is for true
> beginners). If you work on you app a bit you'll gain knowledge in testing,
> migrating, implementing design and much more. I always asked myself 'does
> my program solve a problem'. If it does not, you will get lost pretty
> quickly.
> 3. ?
>
> Not sure what the next step would be? Deploy a small website? Use third
> party OS code? Any suggestions?
>
> Cheers
> wC

-- 
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: Query with no-correspondence results

2011-12-26 Thread Python_Junkie
I have not read all 18 responses, so if I am off base I apologize.

I believe that you want to avg the votes (by gender) of each unique
combination of thing and context.

(First take gender out of the equation)
In order to be able to get the avg votes for the combination of
potatoes and flavor as compared to potatoes and smells you have to
give each combo a unique value and then group on that value.

for example potato and flavor could be =1 and potatoes and smells =2 ,
let's call this combo attribute column

Then you can group by the unique combo attribute, 1,or 2 in this
example

select combo_attribute,COALESCE( AVG( vote ) , 0.0 ) AS average_vote
from
mydatabase_votecontext AS md
group by combo_attribute


You can then join the 3 tables on the user id , no outsr join
necessary and add gender


select gender,combo_attribute,COALESCE( AVG( vote ) , 0.0 ) AS
average_vote  from
mydatabase_votecontext a, mydatabase_user  b, mydatabase_facebookuser
c
where a.id=c.id
group by combo_attribute,gender


On Dec 26, 11:00 pm, wgis  wrote:
> Sorry for digging this up but I have a more complex funcionality to
> implement and I was hoping you could help
>
> I had
>
> mydatabase_votecontext
> (id, name)
> (1, Flavour)
> (2, Smell)
> (3, Usability)
> (4, Size)
>
> mydatabase_vote
> (id, thing, context, user, vote)
> (1, Potatoes, Flavour, Me, 2.0)
> (2, Potatoes, Smell, Me, 4.3)
> (3, Potatoes, Usability, Me, 4.0)
> (4, Carrots, Flavor, Me, 3.0)
> (5, Cars, Smell, Me, 4.2)
> (6, Cars, Usability, Me, 4.9)
>
> and now I also have:
>
> mydatabase_user
> (id, ..)
>
> mydatabase_facebookuser)
> (id, user_id, gender, ...)
>
> I would like to query the average votes by gender :O
>
> I thought if the original was
>
> SELECT mb.id, mb.name, COALESCE( AVG( vote ) , 0.0 ) AS average_vote
> FROM mydatabase_votecontext AS md
> LEFT JOIN restudante_vote ON ( mydatabase_vote.context_id = md.id
>                                         AND thing_id = 1)
> GROUP BY thing_id, name
> ORDER BY md.id
>
> then
>
> SELECT md.id, md.name, COALESCE( AVG( vote ) , 0.0 ) AS average_vote
> FROM mydatabase_votecontext AS md
> LEFT JOIN restudante_vote ON ( mydatabase_vote.context_id = vc.id
>                                         AND thing_id = 1),
> facebook_facebookprofile
> WHERE mydatabase_vote.user_id = facebook_facebookprofile.user_id
> AND facebook_facebookprofile.gender = 'male'
> GROUP BY thing_id, name
> ORDER BY md.id
>
> could be the solution. But the "filter" by gender comes after the LEFT
> JOIN and is messing everything up. It will cut off a vote_context if
> no vote for that context exists (the original, but solved, problem)

-- 
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: compiling python files in django

2011-12-26 Thread Python_Junkie
I assume that you are performing these functions in a view.

I would test the value
grn=submit['grnvalue'])

by rendering this to a template and see what 'gm' spits out.
This way you will find out what is sitting in the variable

On Dec 26, 4:33 am, Mohammad Shahid Siddiqui
 wrote:
> Hi,
>
> I have added one column in the table of mysql db using 'python manage.py
> syncdb' after deleting the table.
> Now from the home page, I am fetching the value of text area, and trying to
> put in the database. The value when written to flat file, is same as
> fetched, but when writing to database, it is inserting null. The code is-
>
> value fetched by-
>
> submit['grnvalue'] = request.GET.get('grnvalue', '')
>
> g = open('/c/coverity/ngcov.lst', 'a')
> g.write("branch=" + submit['branch'] + ";" + "arch=" + submit['arch'] + ";"
> + "targets=" + added_tgts + ";" + "schedule=" + submit['schedule']  +
> ";grn=" + submit['grnvalue']+"\n")
> g.close()
>
> In this file, I am getting the value as put in the text area having id
> 'grnvalue'.
>
> Now I am saving this to database-
> s = Subscribed(name=submit['branch'], status="Subscribed",
> targets=added_tgts, architecture=submit['arch'],
> release=submit['schedule'], running_time=0, user=owner, remarks=notify,
> grn=submit['grnvalue'])
> s.save()
>
> The database contains Table Subscribed where I have added column grn. All
> values are put, but grn field is filled empty all the time.
>
> Please help me in this issue.
>
> --
> Best Regards,
> *M Shahid Siddiqui*
>
> DISCLAIMER:
> This message is intended solely for the use of the individual to whom it is
> addressed. It may contain privileged or confidential information and should
> not be circulated or used for any purpose other than for what it is
> intended. If you have received this message in error, please notify the
> originator immediately. If you are not the intended recipient, you are
> notified that you are strictly prohibited from using, copying, altering, or
> disclosing the contents of this message and you will delete the mail.
> Sender accepts no responsibility for loss or damage arising from the use of
> the information transmitted by this email including any damage from virus.
> Ce courriel et les pièces jointes s’y rattachant sont de nature
> personnelle, privilégiée et confidentielle et pour l’usage exclusif du
> destinataire à qui ils sont adressés et destinés. Si vous avez reçu ce
> courriel par erreur, veuillez s’il vous plaît le renvoyer à l’expéditeur.
> Si vous n’êtes pas le bon destinataire ou si vous croyez ne pas l’être,
> nous vous informons immédiatement que la publication, distribution,
> diffusion, copie ou plagiat de ce courriel et de ses pièces jointes sont
> strictement interdits.

-- 
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 me with this query

2011-12-23 Thread Python_Junkie
You can use the full functionality of sql and python by executing sql
queries using the pyodbc module.

The module is documented at this url
http://code.google.com/p/pyodbc/

You can combine sql and python logic and not have to be constrained by
the abstraction of raw sql or the ORM.
in your django views

Capture the data/transformation in python dictionaries to be rendered
in the template


On Dec 23, 4:48 pm, Sebastian Goll  wrote:
> On Fri, 23 Dec 2011 20:16:11 +0100
>
> Babatunde Akinyanmi  wrote:
> > I actually have a database with thousands of records from which I have
> > to randomly select just 10 records from the thousands during every
> > query. Because of efficiency, I use the normal select with limit query
> > using a random number as offset and 200 as the limit. Next, the idea
> > is to shuffle the results and use the first 10 numbers.
>
> To randomly select 10 records from your model, you can also use
>
>   Model.objects.order_by('?')[0:10]
>
> This translates loosely to something like this SQL statement:
>
>   SELECT … FROM … ORDER BY RANDOM() LIMIT 10
>
> Beware that this might be an expensive and/or slow query, depending on your 
> database backend. Unfortunately, I don't know how each database backend 
> compares. See:
>
>  https://docs.djangoproject.com/en/1.3/ref/models/querysets/#order-by
>
> Regards,
> Sebastian.

-- 
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: Standalone Django scripts

2011-12-23 Thread Python_Junkie
I am not exactly sure how extensive your question is about deployment.

You can just copy the files associated with your local django project/
app to the server in the same exact directory structure, install the
same modules that you had on your local computer and run
the shell script,  /manage.py runserver

This will use the internal django web server

If you want the rest of the world to be able to access this app from
the server, add the IP address of the server to the run server
command.

You can then access the web app by using the ip address

http://ip_address:8000/admin   for example

Of course you should then implement a real web server such as apache
and get a domain name to replace the ip address



On Dec 23, 6:22 am, Ganesh Kumar  wrote:
> Hi guys,
> I am new to django, I trying to develop standalone script (shell
> script), it's working fine in development version, How to can I deploy
> host application to my server,
> any help guys. In development version I have used in one terminal
> start running using shell script, and another terminal start django
> web site. using ./manage runserver command. How to host to my
> application to server. Please guide me.
>
> -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: Trying to create django app to view alarms

2011-12-23 Thread Python_Junkie
I think that building the python code that performs your logic is a
great way to start, and not getting bogged down with django is a great
way to get started.

There are several (relatively straight forward) pieces of django that
you will need to tie together.

I will simply disucss the view.py components and the html template.

Establish your python code as a module.
Import the module in the view and use it in the view.py.

def function_called_for_log_display(request):
..call your python module
...create a python dictionary with the information
that is pulled back by your python module


  .render the html template and pass the
dictionary values to the template


 return render_to_response('polls/index.html',
{'latest_poll_list': latest_poll_list})  #I took this from the django
project tutorial


 ...use the appropriate template tags/logic to display the
results of the dictionary

On Dec 23, 8:08 am, Jim  wrote:
> Hi-
>
> I'm new to Django and pretty basic with Python to be honest, but am
> trying to write a web tool that will let me upload  'before' and
> 'after' files of alarm logs and analyse the differences as follows:
>
>   * alarms cleared during the period (in before, but not after)
>   * alarms raised during the period (in after, but not before)
>   * historic alarms (exist with same timestamp in both before and
> after lists)
>   * existing alarms with activity (exist in before and after lists but
> with differing timestamps)
>
> Ball-park figure for the size of these alarm logs is about 200 KB (=
> about 40 logs).
>
> I've already written a standalone .py script that, takes as inputs the
> filenames of the before and after alarm log files and from this
> creates 6 lists of alarm objects: (before alarms, after alarms, and
> the 4 lists described above).
>
> What I'd like to do is to use Django to upload the alarm data and then
> be able to view the alarms by list.
>
> As a rough and ready starting point, I've created an html form with a
> couple of textareas in, and I seem to be able to paste the entire
> before and alarm files in these, so I can upload the alarms data to
> Django in a form.
>
> Can anyone suggest how best to implement my existing python code in
> the .py file to create a Django solution?
>
> Thanks for any advice.
>
> Jim

-- 
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: Jython zxJDBC / Python cx_oracle wrong number or types of arguments when calling to oracle's stored procedure

2011-12-22 Thread Python_Junkie
I presume that the stored procedure has been created.

I use the python module pyodbc.  Google has good documentation how to
set this up.

then after creating the connection you can execute the stored
procedure

4 lines of code will then create the crsr followed by the execution

crsr.execute('stored_procedure')

On Dec 21, 6:49 am, Daniel Roseman  wrote:
> On Wednesday, 21 December 2011 05:41:53 UTC, Akira Kir wrote:
>
> > 
>
> > {stackoverflow xposted}
>
> Answered on SO.
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Compare two tables in a secondary database

2011-12-22 Thread Python_Junkie
Putting django aside for the moment, are you able to take the sql that
you wrote above and write a python script with the sql code above.

I use the pyodbc module to perform all of my sql scripts.

Once you write the successful python sql script, you can import this
working module into a django view.

If this is the direction that you want to go write me back and I can
help you with that.

On Dec 22, 8:33 pm, Edvinas Narbutas  wrote:
> Yeah, the ORM didn't work out as i thought for this. I have written
> this raw query with a model. Alot less code compared to as before.
>
> class itemSearch(models.Model): typeID =
> models.SmallIntegerField(primary_key = True)    typeName =
> models.CharField(max_length = 200)
>
> item_search_results = itemSearch.objects.raw(
>         '''SELECT * FROM invTypes WHERE invTypes.typeName LIKE '%s%'
> LIMIT 0, 10''', [search_query]
> ).using(
>         'DataDump'
> )
> for name in item_search_results:
>         results.append(name.typeName)
>
> I get this error. "not enough arguments for format string", which im
> guessing the LIKE isnt working because this query works.
>
> item_search_results = itemSearch.objects.raw(
>         '''SELECT * FROM invTypes LIMIT 0, 10'''
> ).using(
>         'DataDump'
> )
>
> for name in item_search_results:
>         results.append(name.typeName)
>
> I have no idea what could be wrong in the query or the model. Any help?
> On Fri, Dec 23, 2011 at 1:07 AM, Python_Junkie
>
>
>
>
>
>
>
>  wrote:
> > I think you are limiting yourself by excluding sql.
>
> > I use the ORM for the admin side of the house and I use sql for all of
> > my web based presentations.
>
> > SQL will do everything that you want to achieve.
>
> > ORM has limitations as you have seen.
>
> > On Dec 22, 7:27 am, kr0na  wrote:
> >> Im trying to compare two tables in a second database that is a
> >> migrated database from mssql. The second database doesn't have any
> >> apps for it, it will only be used for queries.
>
> >> This are my models for the two tables.
> >> from django.db import models
>
> >> class invGroups(models.Model):
> >>         groupID = models.SmallIntegerField(primary_key = True)
> >>         categoryID = models.SmallIntegerField()
>
> >>         def __unicode__(self):
> >>                 return self.item
>
> >>         class Meta:
> >>                 db_table = 'invGroups'
>
> >> class invTypes(models.Model):
> >>         typeID = models.SmallIntegerField(primary_key = True)
> >>         typeName = models.CharField(max_length = 200)
> >>         published = models.SmallIntegerField()
> >>         groupID = models.SmallIntegerField()
>
> >>         def __unicode__(self):
> >>                 return self.item
>
> >>         class Meta:
> >>                 db_table = 'invTypes'
>
> >> And the query so far.
> >> item_search_results = invTypes.objects.using(
> >>         'DataDump'
> >> ).filter(
> >>         typeName__icontains = search_query
> >> )[0:15]
>
> >> I currently can select from only one database, and the query is what i
> >> have so far. I tried to use ForeignKey with no results. Can I do this
> >> without using a RAW query? Im trying to achieve this query:
> >> SELECT
> >> typeName
> >> FROM
> >> invGroups,
> >> invTypes
> >> WHERE
> >> invTypes.groupID = invGroups.groupID and
> >> invGroups.categoryID in (7, 8, 9, 18, 20) and
> >> invTypes.typeName like 'query%'
> >> ORDER BY
> >> invTypes.typeName;
>
> > --
> > 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: Compare two tables in a secondary database

2011-12-22 Thread Python_Junkie
I think you are limiting yourself by excluding sql.

I use the ORM for the admin side of the house and I use sql for all of
my web based presentations.

SQL will do everything that you want to achieve.

ORM has limitations as you have seen.

On Dec 22, 7:27 am, kr0na  wrote:
> Im trying to compare two tables in a second database that is a
> migrated database from mssql. The second database doesn't have any
> apps for it, it will only be used for queries.
>
> This are my models for the two tables.
> from django.db import models
>
> class invGroups(models.Model):
>         groupID = models.SmallIntegerField(primary_key = True)
>         categoryID = models.SmallIntegerField()
>
>         def __unicode__(self):
>                 return self.item
>
>         class Meta:
>                 db_table = 'invGroups'
>
> class invTypes(models.Model):
>         typeID = models.SmallIntegerField(primary_key = True)
>         typeName = models.CharField(max_length = 200)
>         published = models.SmallIntegerField()
>         groupID = models.SmallIntegerField()
>
>         def __unicode__(self):
>                 return self.item
>
>         class Meta:
>                 db_table = 'invTypes'
>
> And the query so far.
> item_search_results = invTypes.objects.using(
>         'DataDump'
> ).filter(
>         typeName__icontains = search_query
> )[0:15]
>
> I currently can select from only one database, and the query is what i
> have so far. I tried to use ForeignKey with no results. Can I do this
> without using a RAW query? Im trying to achieve this query:
> SELECT
> typeName
> FROM
> invGroups,
> invTypes
> WHERE
> invTypes.groupID = invGroups.groupID and
> invGroups.categoryID in (7, 8, 9, 18, 20) and
> invTypes.typeName like 'query%'
> ORDER BY
> invTypes.typeName;

-- 
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: new tables missing from admin page

2011-12-20 Thread Python_Junkie
You should confirm that the tables that you added to the database, do
in fact exist, by querying the database, before wondering why they did
not show up in the admin page

On Dec 20, 9:08 pm, Karen Tracey  wrote:
> No, it doesn't happen automatically. (Unless prior to this change you were
> using plug-in apps that all provided an admin.py file to register their
> models.) For any models in apps you write, you must explicitly register
> them with admin in order for them to be visible in admin.
>
> Karen
> --http://tracey.org/kmt/

-- 
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: template newlines

2011-08-14 Thread Python_Junkie
If you have a solution that is fine.

But if you did the business logic in the view, there is no need for

{%- if interests|length > 0 %}   and you would  simply return your
dictionary values while rendening as a variable that contains actual
values
and no need for the if statement which provides the extra carriage
return

{% for event, interests in report.items %}
   {{event}}

On Aug 14, 7:28 am, Sam Lai  wrote:
> On 14 August 2011 14:00, Python_Junkie  wrote:
>
> > I think that if you performed the logic to determine if there actually
> > is something in the interest for that row in the view and
> > then only pass those components from the view, and not in the template
> > then your problem goes away.
>
> I don't think so, but I haven't tested it. Django's template parser
> does not remove newlines anywhere, even if only a template directive
> exists on that line. For HTML, this isn't an issue. You can try
> sacrificing template readability by putting everything on to one line.
>
> There has been a fair bit of discussion about this, but no consensus
> was arrived at. For now, the better solution is to use jinja2
> (http://jinja.pocoo.org/). Its language is based on Django's, and is
> largely compatible, but it has the added bonus of being able to remove
> newlines like so,
>
> {%- if interests|length > 0 %}
> ...
> {%- endif %}
>
> Notice the - after the % sign. This tells jinja2 to remove the
> previous newline character. You can also add them at the closing % to
> remove the following newline character.
>
> It is pretty easy to use with Django (and many people do), and you can
> just use it for this particular template, leaving all others to use
> Django's in-built templating system.
>
>
>
>
>
>
>
>
>
> > On Aug 13, 8:53 pm, CrabbyPete  wrote:
> >> I'm using the django template system for format a text email. I send
> >> it a dictionary and it formats the output. The problem is that it
> >> inserts lots of newlines
>
> >> Here is the template, and reports is a dictionary that contains an
> >> event and a dictionary of interests
>
> >> Weekly Contact List For {{date}}
> >> {% for event, interests in report.items %}
> >>     {% if interests|length > 0 %}
> >>         {{event}}
> >>         {% for interest, value in interests.items %}
> >>             {{ value }} {% if value == 1 %} lead {% else %} leads {%
> >> endif %} for {{ interest }}
> >>         {% endfor %}
> >>     {% endif %}
> >> {% endfor %}
>
> >> Is there a way for it just to print the lines without adding all the
> >> extra blank lines when interests = 0?
>
> > --
> > 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: How to store variable timedeltas in a Django model?

2011-08-14 Thread Python_Junkie
One of the reasons that I migrated to django is because of the
underlying functionality.. With that said I would use a separate table
or file, whichever you are comfortable with , to store the changing
time delta variable.

You could dynamically retrieve this variable in the view or, the
example that django provides is to create a function in the models.py
and call that function from the model that you wanted to use the time
delta

https://docs.djangoproject.com/en/1.3/topics/db/managers/

The code on this page that I am referring to is:

class PollManager(models.Manager):
def with_counts(self):
from django.db import connection
cursor = connection.cursor()
cursor.execute("""
SELECT p.id, p.question, p.poll_date, COUNT(*)
FROM polls_opinionpoll p, polls_response r
WHERE p.id = r.poll_id
GROUP BY 1, 2, 3
ORDER BY 3 DESC""")
result_list = []
for row in cursor.fetchall():
p = self.model(id=row[0], question=row[1],
poll_date=row[2])
p.num_responses = row[3]
result_list.append(p)
return result_list

class OpinionPoll(models.Model):
question = models.CharField(max_length=200)
poll_date = models.DateField()
objects = PollManager()
**

The function that you want would be repalced with the much simpler sql

select timedelta from time_delta ##table






On Aug 14, 1:10 am, Karen Rustad  wrote:
> Hello all,
>
> In one of my models, I want to store a timedelta--a length of time not
> tied to a particular start and end date. Although timedeltas are built
> into Python, tragically there's no TimeDeltaField in Django.
>
> Extra complications:
>
> * The timedelta can be quite large -- on the scale of one week to
> several months.
> * The timedelta has a default value, but it can be changed by the
> administrator.
> * I want the default timedelta length to be one month (which, of
> course, has a variable number of days!)
>
> It seems like *someone* has to have been able to do this, if only as a
> custom model field. But I wasn't able to find anything in the archives
> on this list and the #django IRC logger down so I couldn't search
> that. :/
>
> I did read the docs on how to write a custom model, but it looks
> terribly confusing--it's not clear which or how many of the attributes
> mentioned in the docs I would need to customize, given that it *is* a
> built-in Python variable type, and I have exactly zero experience
> dealing with databases directly.
>
> If anyone's got a hack around this limitation to recommend, or even
> some more relevant sample code than what's in the custom model docs,
> that would be super helpful!
>
> -- Karen

-- 
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: Connecting to the django app from outside the server

2011-08-14 Thread Python_Junkie
Thank you.

I got the same resolution from a previous django aficianado and it
worked perfectly.



On Aug 14, 5:01 am, Subhranath Chunder  wrote:
> If the external IP or some domain name lands you directly on your machine,
> then:
> python manage.py runserver 0.0.0.0:
> would do.
>
> To access you can use: http://:
>
> This should do. Hope it helps.
>
> Thanks,
> Subhranath Chunder.www.subhranath.com
>
> On Sun, Aug 14, 2011 at 9:12 AM, Python_Junkie <
>
>
>
>
>
>
>
>
>
> software.buy.des...@gmail.com> wrote:
> > I have placed my django application on the virtual server from go
> > daddy.  The application runs  when I remote into the server and run
> > the web pages with localhost on the 8000 port.
>
> > How do I connect to this web page for demonstration purposes when I am
> > not remoting into the virtual server.
>
> > I tried just replacing localhost with the IP address with port 8000
> > and that does not work.
>
> > Do I need to open up port 8000 ?
>
> > Is it possibly a permissions issue.
>
> > I am presuming that I can continue to use the django light weight web
> > server for demonstration purposes.
>
> > Any assistance would be appreciated.
>
> > 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.
>
> --
> Thanks,
> Subhranath Chunder.www.subhranath.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Connecting to the django app from outside the server

2011-08-14 Thread Python_Junkie
You are a true genius!

Thank you

The runserver command with the ip address with the IP worked
perfectly.

Thank you again

On Aug 14, 12:33 am, Landy Chapman  wrote:
> >The application runs  when I remote into the server and run
> > the web pages with localhost on the 8000 port.
> > How do I connect to this web page for demonstration purposes when I am
> > not remoting into the virtual server.
>
> > I tried just replacing localhost with the IP address with port 8000
> > and that does not work.
>
> What command do you use to start the server?  If your IP was
> 33.215.11.2 it would look like:
>     python manage.py runserver 33.215.11.2:8000
>
> > Do I need to open up port 8000 ?
>
> Yes  Or figure out what port is already open and use that... Also
> check firewall status.
>
> > Is it possibly a permissions issue.
>
> Most likely not.
>
> > I am presuming that I can continue to use the django light weight web
> > server for demonstration purposes.
>
> Yes

-- 
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: template newlines

2011-08-13 Thread Python_Junkie
I think that if you performed the logic to determine if there actually
is something in the interest for that row in the view and
then only pass those components from the view, and not in the template
then your problem goes away.



On Aug 13, 8:53 pm, CrabbyPete  wrote:
> I'm using the django template system for format a text email. I send
> it a dictionary and it formats the output. The problem is that it
> inserts lots of newlines
>
> Here is the template, and reports is a dictionary that contains an
> event and a dictionary of interests
>
> Weekly Contact List For {{date}}
> {% for event, interests in report.items %}
>     {% if interests|length > 0 %}
>         {{event}}
>         {% for interest, value in interests.items %}
>             {{ value }} {% if value == 1 %} lead {% else %} leads {%
> endif %} for {{ interest }}
>         {% endfor %}
>     {% endif %}
> {% endfor %}
>
> Is there a way for it just to print the lines without adding all the
> extra blank lines when interests = 0?

-- 
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.



Connecting to the django app from outside the server

2011-08-13 Thread Python_Junkie
I have placed my django application on the virtual server from go
daddy.  The application runs  when I remote into the server and run
the web pages with localhost on the 8000 port.

How do I connect to this web page for demonstration purposes when I am
not remoting into the virtual server.

I tried just replacing localhost with the IP address with port 8000
and that does not work.

Do I need to open up port 8000 ?

Is it possibly a permissions issue.

I am presuming that I can continue to use the django light weight web
server for demonstration purposes.

Any assistance would be appreciated.


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.



Re: SQL Server Support - Does it Exist

2011-07-14 Thread Python_Junkie
I have tried django-mssql without any luck.

Could you send me the link for django-pyodbc.

I was only able to find 2 downloads that say they have been
deprecated.

By the way I have been using the (sql) pyodbc for my native (MySQL)
sql connections to retrieve data.  I would rather use sql rather than
the ORM.

So, presently the syncdb is a nice to have which allows me to utilize
the admin functionality as well as the built in Forms.py
functionality.  Otherwise I could use sql server to make my calls to
the database to populate web pages and or insert or update.

Any other calls to the database I can accomplish to sql server through
pyodbc and sql.



On Jul 14, 8:42 pm, David Graves  wrote:
> https://docs.djangoproject.com/en/1.3/ref/databases/#using-a-3rd-part...
> django-mssql
>
> http://stackoverflow.com/questions/842831/using-sql-server-with-djang...
>
> I personally have used django-pyodbc in conjunction with pyodbc.
>
> On Thu, Jul 14, 2011 at 5:03 PM, bruno desthuilliers <
>
>
>
>
>
>
>
> bruno.desthuilli...@gmail.com> wrote:
>
> > On 14 juil, 23:15, Python_Junkie 
> > wrote:
> > > I have searched for the drivers to use the syncdb utility with MS SQL
> > > Server but have been unsuccessful.
>
> >https://docs.djangoproject.com/en/1.3/ref/databases/
>
> > Django doesn't support MS SQL.
>
> > --
> > 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: SQL Server Support - Does it Exist

2011-07-14 Thread Python_Junkie
I have installed django-mssql and still seem to be stuck.

What are the correct attributes that need to be set in the settings.py
file?

I am getting an error

This is how I have configured my settings.py file

DATABASE

S = {
'default': {
'NAME': 'notes',
'ENGINE': 'django.db.backends.sqlserver_ado',
'HOST': ' ',  #blank for local host
'USER': '',#blank for active directory authentication
'PASSWORD': '',
'OPTIONS' : {
'provider': 'SQLOLEDB',
'use_mars': True,
},
}
}



I am getting the following error when I attempt to syncdb

*
django.core.exceptions.ImproperlyConfigured: 'sqlserver_ado' isn't an
available
database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2',
'sqlite3'
Error was: No module named sqlserver_ado.base
***
I have MYSQL up and running, just trying to use a different database


Thanks for any assistance that you can provide


On Jul 14, 9:07 pm, Russell Keith-Magee 
wrote:
> On Fri, Jul 15, 2011 at 6:03 AM, bruno desthuilliers
>
>  wrote:
>
> > On 14 juil, 23:15, Python_Junkie 
> > wrote:
> >> I have searched for the drivers to use the syncdb utility with MS SQL
> >> Server but have been unsuccessful.
>
> >https://docs.djangoproject.com/en/1.3/ref/databases/
>
> > Django doesn't support MS SQL.
>
> Django doesn't provide *official* support MSSQL. However, we do have a
> supported backend API, and there are several third-party projects that
> implement MS SQL support [1]. I can't comment on their completeness or
> stability, but the projects exist.
>
> [1]https://docs.djangoproject.com/en/1.3/ref/databases/#using-a-3rd-part...
>
> Yours,
> Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



SQL Server Support - Does it Exist

2011-07-14 Thread Python_Junkie
I have searched for the drivers to use the syncdb utility with MS SQL
Server but have been unsuccessful.

Has anyone implemented SQL server.

If you have could you point me to the links for driver downloads and
the settings.py parameters.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: need more than 1 value to unpack error

2011-06-25 Thread Python_Junkie
I found the error.

After reviewing my own post and realizing that I was getting the same
error regardless of the syntax that I was using, and only when I was
using a template, I realized where the solution was.

The settings.py The template directory was not set up.

It is all good now.
My bad

On Jun 25, 5:54 pm, Python_Junkie 
wrote:
> I am just getting started with django.  Have been a python developer
> for a number of years
>
> I am following the examples in the book The Definitive Guide to Django
> and the same error keeps popping up.
>
> "need more than 1 value to unpack"
>
> I understand what it is trying to say, but I do not see where the
> problem lies.
>
> I have written 2 almost similar functions.
> The first works ( I know that it is not elegant code)
> The second gives me the above error.
>
> def current_section(request):
>     title="This is the best web page"
>     fp=open('my_page.html')
>     t=Template(fp.read())
>     fp.close()
>     html=t.render(Context({'title':title}))
>     return HttpResponse(html)
>
> def current_section(request):
>     title="This is the best web page"
>     return render_to_response('my_page.html',{'title':title})
>
> Also, in the first fucntion above I am getting the same error when I
> use the {% include 'nav.html' %} in my_page.html
>
> and I am also getting the same error when I use template tags.
>
> It is happening in so many areas, that there has to be something
> commonly incorrect.
>
> Any suggestions would be much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



need more than 1 value to unpack error

2011-06-25 Thread Python_Junkie
I am just getting started with django.  Have been a python developer
for a number of years

I am following the examples in the book The Definitive Guide to Django
and the same error keeps popping up.


"need more than 1 value to unpack"

I understand what it is trying to say, but I do not see where the
problem lies.

I have written 2 almost similar functions.
The first works ( I know that it is not elegant code)
The second gives me the above error.

def current_section(request):
title="This is the best web page"
fp=open('my_page.html')
t=Template(fp.read())
fp.close()
html=t.render(Context({'title':title}))
return HttpResponse(html)


def current_section(request):
title="This is the best web page"
return render_to_response('my_page.html',{'title':title})

Also, in the first fucntion above I am getting the same error when I
use the {% include 'nav.html' %} in my_page.html

and I am also getting the same error when I use template tags.

It is happening in so many areas, that there has to be something
commonly incorrect.

Any suggestions would be much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.