Re: Specific models without a database table

2011-08-20 Thread sedl...@gmail.com
Hi,
you may use custom model manager (responsible for retrieving objects
from DB) and custom save method (which would not call Model.save),
together with managed=True.

You may still face some issues, however I think this should be
possible.

Cheers,
Filip

On 20 srp, 12:51, Malcolm Box  wrote:
> On 20 August 2011 02:33, Kristofer Pettijohn wrote:
>
> > Hello,
>
> > Is it possible to create specific models without a database table?
>
> Yes, it's possible. You want the "managed" attribute on the model - 
> seehttps://docs.djangoproject.com/en/1.3/ref/models/options/#managed
>
> This will prevent Django from creating or modifying the db table
>
> > Basically what I would like to do is create an email account management
> > application that ties into my existing mail server and its API.  I would
> > like Django to have a Users model and keep track of users, a Domains model
> > to keep track of the email domains for the user, but I don't want it to
> > actually keep track of email addresses.  Once the user is in the
> > application, they will go into the "EmailAccount" model and I simply want
> > the model to query my mail server via its SOAP API.  So when they
> > create/delete/edit email accounts, there will be form pages and simple
> > validation done by Django, but the actual work will be done by connecting to
> > the mail servers API and not a database.
>
> Is this possible?
>
> That is substantially harder, but could be possible. The main problem is
> that the Django ORM will want to write SQL queries when there's a link to
> the EmailAccount model.
>
> Your best bet is probably a proxy model that contains a reference to the
> relevant API record (e.g. the email address identifier or whatever the API
> uses), and then a custom save() method that writes the values out to the DB.
> You can use the Django form logic etc without it needing to be backed by a
> model.
>
> It will largely depend on how you want the EmailAccount to look - the closer
> you want it to work to a standard ORM model, the more work you'll have to do
> to trick things. If it's a simple field that isn't used for queries, then
> you could look at creating a custom field type that knows how to read/write
> the values to the API.
>
> All the above advice is worth exactly what you paid for it!
>
> Malcolm

-- 
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: Run an application periodically on django

2011-08-05 Thread sedl...@gmail.com
Hi,
just one thought - if the update is not much time-consuming, you can
write your view which allways parses the data and then cache the view
for 30 seconds. That way if nobody looks at your page, you won't do
useless work in the background.

See https://docs.djangoproject.com/en/dev/topics/cache/

Regards,
Filip

On 5 srp, 13:02, Mohamed Ghoneim  wrote:
> Thanks guys,
> That was really helpful, have a nice day
>
> --
> Mohamed Sayed Ghoneim
>
>
>
> On Fri, Aug 5, 2011 at 4:37 AM,  wrote:
> > I am out of office right now and will get back to you when I return. If you
> > don't hear from me, my assistant should contact you shortly. Check out this
> > massage chair that I just bought to help relax me after work!.Click 
> > Here
>
> > Enable images or click 
> > here
>
> > 
> > Let me know what you think after you have a chance to review.
> > Cheers!
>
> > If you no lon ger wish to receive emails, please 
> > unsubscribe
>
> > 866-288-1880
> > 5150 yarmouth ave, Encino, CA 91316
>
> > On Thu, 4 Aug 2011 08:12:21 +0300, Mohamed Ghoneim ** wrote:
> > Hey guys,
>
> > I am new to djnago and I have= heard a lot about its powerful capabilities,
> > so I=A0preferred=A0it over ot= her web frameworks.
>
> > My problem is I have a webpage= that its content should be updated
> > automatically every 30 seconds as I bui= ld an app that gets data from
> > another web page
> > and parse it and then updates my webpage.
>
> > My = problem is how can I schedule this this app to run every 30 seconds?
> > and ca= n I do this on a hosting website?
> > -- Mohamed Sayed Ghoneim
>
> >  --
> > 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+unsubscribe@goog=
> > legroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django=
> > -users?hl=3Den .– 
> > Skrýt citovaný text –
>
> – Zobrazit citovaný text –

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