Re: Which is the best way of query a database view(no from Django model)

2011-11-03 Thread Andre Lopes
Hi Daniel, thanks for the reply.

I have tested to "inspectdb" but I think the schema is to complex, for
example... for the table "tdir_files_context" (djangoinspectdb.JPG
"image in attachment") I got this model:

[code]
class TdirFilesContext(models.Model):
id_category = models.ForeignKey(TdirCategories, db_column='id_category')
id_file_context = models.CharField(max_length=20)
n_file_context = models.CharField(max_length=150)
coment = models.CharField(max_length=2000)
id_user_db_ins = models.CharField(max_length=45)
id_user_db_upd = models.CharField(max_length=45)
id_user_sys_ins = models.CharField(max_length=45)
id_user_sys_upd = models.CharField(max_length=45)
date_ins = models.DateTimeField()
date_last_upd = models.DateTimeField()
class Meta:
db_table = u'tdir_files_context'
[/code]

This database table have Two primary keys and One foreign key. The
Django Model handle this kind of database tables?


Best Regards,




>> I'm a new to Django...
>>
>> I have a database schema that stores me information that I want to
>> show in a Django website. This database schema have nothing to do with
>> a Django App...
>>
>> Which is the best way of doing this in Django? I have read the
>> documentation and seems to me that I will need to use "custom SQL
>>
>> directly"(https://docs.djangoproject.com/en/1.3/topics/db/sql/#executing-custom-sql-directly),
>> right?
>>
>> If this is correct, where should I put the SQL queries, in "views.py"?
>>
>> Best Regards,
>
> Is there any reason why you can't create models from your existing schema?
> See https://docs.djangoproject.com/en/1.3/howto/legacy-databases/
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/khJaBBbvxfIJ.
> 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: Which is the best way of query a database view(no from Django model)

2011-11-03 Thread Daniel Roseman
On Thursday, 3 November 2011 20:04:30 UTC, Andre Lopes wrote:
>
> Hi,
>
> I'm a new to Django...
>
> I have a database schema that stores me information that I want to
> show in a Django website. This database schema have nothing to do with
> a Django App...
>
> Which is the best way of doing this in Django? I have read the
> documentation and seems to me that I will need to use "custom SQL
> directly"(
> https://docs.djangoproject.com/en/1.3/topics/db/sql/#executing-custom-sql-directly
> ),
> right?
>
> If this is correct, where should I put the SQL queries, in "views.py"?
>
>
> Best Regards,
>

Is there any reason why you can't create models from your existing schema? 
See https://docs.djangoproject.com/en/1.3/howto/legacy-databases/
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/khJaBBbvxfIJ.
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.



Which is the best way of query a database view(no from Django model)

2011-11-03 Thread Andre Lopes
Hi,

I'm a new to Django...

I have a database schema that stores me information that I want to
show in a Django website. This database schema have nothing to do with
a Django App...

Which is the best way of doing this in Django? I have read the
documentation and seems to me that I will need to use "custom SQL
directly"(https://docs.djangoproject.com/en/1.3/topics/db/sql/#executing-custom-sql-directly),
right?

If this is correct, where should I put the SQL queries, in "views.py"?


Best Regards,

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