Postgres paginator fixing slow count(*)

2011-11-07 Thread Alec
I've seen many posts about how slow PostgreSQL is when doing count(*)
and how this gets called in the admin all the time, so I thought I'd
share a simple paginator class override to use the RELTUPLES statistic
when the query is not filtered.  This should speed up the loading of
the default admin page for a large table!

http://djangosnippets.org/snippets/2593/

Alec

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



Admin - click through to parent / child

2011-02-16 Thread Alec
Hi,

I'm wondering if there are any add-ons that show a list of children
and give the ability to click through to parent or children records.
I'm aware of the InlineAdmin feature, but I'm thinking of a non-
editable list of children for all relations that automatically (i.e.
no need to edit admin.py for each model) appears below the record you
are currently editing.  For lookup/parent fields, where there is
currently the drop down to select the parent, you would also be able
to click the name to go directly to that parent record.

Any ideas?  Google didn't find me anything yet.

Thanks,
Alec

-- 
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: Admin - click through to parent / child

2011-02-18 Thread Alec
Thanks for the ideas, but those projects are more for arbitrary
relationships.  I'm thinking about just extending the basic
functionality of the admin site like in this image:

http://i53.tinypic.com/16h10m0.png

On Feb 18, 2:03 am, Derek  wrote:
> On Feb 16, 7:22 pm, Alec  wrote:
>
> > Hi,
>
> > I'm wondering if there are any add-ons that show a list of children
> > and give the ability to click through to parent or children records.
> > I'm aware of the InlineAdmin feature, but I'm thinking of a non-
> > editable list of children for all relations that automatically (i.e.
> > no need to edit admin.py for each model) appears below the record you
> > are currently editing.  For lookup/parent fields, where there is
> > currently the drop down to select the parent, you would also be able
> > to click the name to go directly to that parent record.
>
> > Any ideas?  Google didn't find me anything yet.
>
> Closest I could find was this 
> question:http://stackoverflow.com/questions/4334302/django-best-way-for-simple...
>
> Maybe this is something that could be done in a Django app.  A
> potential problem is that apps tend to shy away from having/using
> templates; but I guess if this was based on standard Admin code, then
> it could be do-able?

-- 
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: Can't import flup.server.fcgi

2009-03-29 Thread alec resnick

For others running into this problem, pulling from the django trunk
and running with the most recent version fixed this problem for me.
Thanks!

-a.

On Mar 19, 8:31 pm, coffeepunk  wrote:
> > This has been reported as ticket #10556 earlier today. It will be fixed
> > in the next few hours, I suspect. So back up a few versions for now or
> > apply the patch in that ticket manually.
>
> Sweet! I've been looking around like crazy, searching on google and
> djangoproject but without finding any answer or the ticket. Since I
> was on a fresh installed server I was starting to pull my hair,
> wondering over why it wouldn't work, but now I know why at least.
>
> Thanks for the Answer Malcom.
>
> 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
-~--~~~~--~~--~--~---



Re: is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread Alec Shaner
Based on what you described as your intent, have you looked at
ModelChoiceField?  You could create a new table, e.g. ProductOptions, that
has a foreign key to your Product table. In your form class you can then
pass a queryset into the ModelChoiceField that selects only the options for
that product, and if necessary even filter out any options that aren't
available  - assuming your ProductOption table had a quantity field.

If you have many products that share a common set of options (e.g., all
shirts have S, M, L, XL, etc.) you might design the tables a little
differently, but ultimately a ModelChoiceField can be passed any queryset
that filters the correct options.

If you prefer to store each product's options as a comma separated field,
you can still do what was suggested previously and just pass the choices
into the init method of the form.

Regarding your issue of needing an iterable - as was stated by Steve Holden
if you have a method that produces the choices, then you want to call that
method, e.g., choices=foo.create_choices(), not choices=foo.create_choices.

On Tue, Aug 3, 2010 at 2:29 PM, shofty  wrote:

> cheers for reading Steve.
>
> I've been through the documentation again and it definitely states
> that the widget wants an iterable. so i dont think im going to be able
> to do what i wanted to do, need another approach.
>
> Matt
>
> On 3 Aug, 16:15, Steve Holden  wrote:
> > On 8/3/2010 11:12 AM, shofty wrote:
> >
> > > Steve,
> >
> > > the choices are different for each product in the shop.
> > > some choices are clothing sizes, some physical sizes etc.
> >
> > > So with that in mind i could go with a bunch of choices hooked up to a
> > > choices field if i can tell the form which choice field to use based
> > > around the product attribute stored.
> >
> > > but what if im not the shop admin?
> > > in that case i'd have to amend the code every time something goes out
> > > of stock in a certain size.
> >
> > > so i came upon the plan to have a boolean denote whether or not the
> > > object has a size option and if so store the options in the model so
> > > that it could be amended in the admin pages. then draw a select at
> > > runtime with the right options in it.
> >
> > > thanks for the other pointers, i had an idea the function wasn't right
> > > and indeed it isn't going to work at all since the widget won't allow
> > > a callable.
> >
> > > i'll try turning that function into a method on the form and see if it
> > > won't work that way
> >
> > Good stuff. This is a pretty helpful group, so do post again when you
> > have further issues. Nobody gets it right the first time ...
> >
> > regards
> >  Steve
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: TypeError: decoding Unicode is not supported

2010-08-03 Thread Alec Shaner
unicode gives me nightmares.

Taking django out of the picture for a moment:
>>> unicode('foo', 'utf-8')
u'foo'
>>> unicode(u'foo', 'utf-8')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: decoding Unicode is not supported

So I would assume when you run it inside django you're already using a
unicode string. Do you need to pass the encoding argument ('utf-8') to
unicode?

On Tue, Aug 3, 2010 at 3:30 PM, sohesado  wrote:

> Hi
>
> I'm currently developing a django project and i've encountered a
> problem regarding Unicode string manipulation.
>
> There is a backend python module in my project that perform's mainly
> shutil (shell utilities) tasks.
>
> I get an TypeError: "decoding Unicode is not supported" exception
> while running the following method
>
>
> -
> def create_base(name, reg):
>path = unicode(ROOT + name, 'utf-8')  error at this line
>shutil.copytree(ROOT + 'matrix', path)
>shutil.copystat(ROOT + 'matrix', path)
>
>f = codecs.open(path + '/conf/local.php', "w", "UTF-8")
>tmp = unicode("f.write(tmp)
>if not reg:
>f.write("$conf['disableactions'] = 'register';\n")
>
> ---
>
> The weird thing that puzzles me is that when i test the module in a
> python shell , the method runs flawlessly which yields me to the
> assumption that it's a django thing.
> By the way i use apache+mod-python as a web-server
>
> I can't get adequate information regarding this type of exception. I'm
> stuck , please help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: TypeError: decoding Unicode is not supported

2010-08-04 Thread Alec Shaner
I'm no expert on encodings so I can only suggest some alternatives that
might get around the issue:

First, maybe you can find something here:
http://docs.python.org/howto/unicode

You could try the literal method of generating a unicode string:

path = u'%s%s' % (ROOT, name)

Where exactly do you get the UnicodeEncodeError exception when you remove
the unicode calls?

On Wed, Aug 4, 2010 at 11:00 AM, sohesado  wrote:

> Well your example clarifies the problem. I removed the unicode calls.
>
> The initial problem was an  UnicodeEncodeError exception. I tried to
> solve it by encoding the strings to utf-8. It seems that's not the
> case.
> So i'm at square one.
>
> Note that..
> -with python manage.py runserver the app runs flawlessly.
> -With apache+mod-python i get an UnicodeEncodeError.
>
> So , it is an apache localization issue?
>
> My /etc/apache2/envvars contains
>
>
> 
> export APACHE_RUN_USER=www-data
> export APACHE_RUN_GROUP=www-data
> export APACHE_PID_FILE=/var/run/apache2.pid
>
> ## The locale used by some modules like mod_dav
> export LANG='el_GR.UTF8'<- also tried el_GR.UTF-8 variation
> export LC_ALL='el_GR.UTF8'
> ## Uncomment the following line to use the system default locale
> instead:
> #. /etc/default/locale
>
> export LANG
>
> -
>
> Have you got any clues what may cause the problem?
>
> Thank you for your help.
>
> On Aug 3, 11:31 pm, Alec Shaner  wrote:
> > unicode gives me nightmares.
> >
> > Taking django out of the picture for a moment:>>> unicode('foo', 'utf-8')
> > u'foo'
> > >>> unicode(u'foo', 'utf-8')
> >
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > TypeError: decoding Unicode is not supported
> >
> > So I would assume when you run it inside django you're already using a
> > unicode string. Do you need to pass the encoding argument ('utf-8') to
> > unicode?
> >
> > On Tue, Aug 3, 2010 at 3:30 PM, sohesado  wrote:
> > > Hi
> >
> > > I'm currently developing a django project and i've encountered a
> > > problem regarding Unicode string manipulation.
> >
> > > There is a backend python module in my project that perform's mainly
> > > shutil (shell utilities) tasks.
> >
> > > I get an TypeError: "decoding Unicode is not supported" exception
> > > while running the following method
> >
> > >
> -
> > > def create_base(name, reg):
> > >path = unicode(ROOT + name, 'utf-8') <<<< error at this line
> > >shutil.copytree(ROOT + 'matrix', path)
> > >shutil.copystat(ROOT + 'matrix', path)
> >
> > >f = codecs.open(path + '/conf/local.php', "w", "UTF-8")
> > >tmp = unicode(" > >f.write(tmp)
> > >if not reg:
> > >f.write("$conf['disableactions'] = 'register';\n")
> >
> > >
> ---
> >
> > > The weird thing that puzzles me is that when i test the module in a
> > > python shell , the method runs flawlessly which yields me to the
> > > assumption that it's a django thing.
> > > By the way i use apache+mod-python as a web-server
> >
> > > I can't get adequate information regarding this type of exception. I'm
> > > stuck , please help.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@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-us...@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-us...@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: TypeError: decoding Unicode is not supported

2010-08-04 Thread Alec Shaner
Ah, maybe that makes more sense then. It does indeed sound like locale issue
with your apache + mod_python envrionment. I see an old django ticket that
sounds pretty similar:

http://code.djangoproject.com/ticket/8965

Sounds like you're still getting ASCII as the default encoding despite the
env settings in apache?

Out of curiosity I created a view to dump the encoding in my django dev app
by calling locale.getpreferredencoding(). In both apache+mod_wsgi and django
development server it returns UTF-8. My linux box is configured with UTF-8
as the default, so I haven't done anything special with apache. If you put
that in your code and it has UTF-8 in both cases then this issue is beyond
me.

On Wed, Aug 4, 2010 at 4:10 PM, sohesado  wrote:

>
>
>
> On Aug 4, 6:48 pm, Alec Shaner  wrote:
> > I'm no expert on encodings so I can only suggest some alternatives that
> > might get around the issue:
> >
>
> > First, maybe you can find something here:
> http://docs.python.org/howto/unicode
>
> i've read , pretty much everything,  available at docs.python.org
> regarding unicode.
>
> > You could try the literal method of generating a unicode string:
> >
> > path = u'%s%s' % (ROOT, name)
> tried it. The problem persists
> > Where exactly do you get the UnicodeEncodeError exception when you remove
> > the unicode calls?
>
> I get the the exception at this line -> shutil.copytree(ROOT +
> 'matrix', path)
>
> And the traceback...
>
> Traceback:
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>  100. response = callback(request,
> *callback_args, **callback_kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> decorators.py" in _wrapped_view
>  25. return view_func(request, *args, **kwargs)
> File "/home/sohesado/codein/wikitool/creators/views.py" in create_wiki
>  42.   doku_script.create_wiki(w.name, tmpl,
> request.POST['access_policy'], reg)
> File "/home/sohesado/codein/wikitool/creators/doku_script.py" in
> create_wiki
>  10.   create_base(name, reg)
> File "/home/sohesado/codein/wikitool/creators/doku_script.py" in
> create_base
>  16.   shutil.copytree(ROOT + u'matrix', path)
> File "/usr/lib/python2.6/shutil.py" in copytree
>  146. os.makedirs(dst)
> File "/usr/lib/python2.6/os.py" in makedirs
>  157. mkdir(name, mode)
>
> Exception Type: UnicodeEncodeError at /wikitool/creators/create_wiki/
> Exception Value: 'ascii' codec can't encode characters in position
> 19-25: ordinal not in range(128)
>
>
> >
> > On Wed, Aug 4, 2010 at 11:00 AM, sohesado  wrote:
> > > Well your example clarifies the problem. I removed the unicode calls.
> >
> > > The initial problem was an  UnicodeEncodeError exception. I tried to
> > > solve it by encoding the strings to utf-8. It seems that's not the
> > > case.
> > > So i'm at square one.
> >
> > > Note that..
> > > -with python manage.py runserver the app runs flawlessly.
> > > -With apache+mod-python i get an UnicodeEncodeError.
> >
> > > So , it is an apache localization issue?
> >
> > > My /etc/apache2/envvars contains
> >
> > >
> ---
> -
> > > export APACHE_RUN_USER=www-data
> > > export APACHE_RUN_GROUP=www-data
> > > export APACHE_PID_FILE=/var/run/apache2.pid
> >
> > > ## The locale used by some modules like mod_dav
> > > export LANG='el_GR.UTF8'<- also tried el_GR.UTF-8 variation
> > > export LC_ALL='el_GR.UTF8'
> > > ## Uncomment the following line to use the system default locale
> > > instead:
> > > #. /etc/default/locale
> >
> > > export LANG
> >
> > >
> ---
> --
> >
> > > Have you got any clues what may cause the problem?
> >
> > > Thank you for your help.
> >
> > > On Aug 3, 11:31 pm, Alec Shaner  wrote:
> > > > unicode gives me nightmares.
> >
> > > > Taking django out of the picture for a moment:>>> unicode('foo',
> 'utf-8')
> > > > u'foo'
> > > > >>> unicode(u'

Re: overriding model.save()

2010-08-05 Thread Alec Shaner
The "new" values are what you just set: in your example, self.a=3 and
self.b=4 if you're inside your custom save method. Then you can get the
current values from the database from inside your custom save with something
like:

current = Foo.objects.get(pk=self.pk)

and inspect current.b for special values.

On Thu, Aug 5, 2010 at 2:54 PM, Sells, Fred wrote:

> That part makes sense, but where would I find the "new" values that have
> been set but not saved when my custom save() method is called? Like
>
> X.a=3
> X.b=4
> X.save()
>
> I want to see if b is a special value before saving.
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
> On Behalf Of Sam Lai
> Sent: Thursday, August 05, 2010 7:58 AM
> To: django-users@googlegroups.com
> Subject: Re: overriding model.save()
>
> On 5 August 2010 03:05, Sells, Fred  wrote:
> > I would like to prevent saving a new value if the database contains a
> > specific value.  This is on a per field, per record basis.
> >
> > If I override the save() method; is there a way to find the existing (in
> > the DB) values and the new (to be stored) values?
>
> Just perform database queries as per normal inside the save() method.
>
> You have access to the object to be stored as well, see
>
> http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods
>
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@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-us...@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-us...@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-us...@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: queryset field order

2010-08-06 Thread Alec Shaner
You can't use a dictionary if you expect a certain order of key/value pairs.

Given model A you could get a list of field objects in the same order (I
think) as defined in the model class

A._meta.fields

At least with that information you could programatically produce a list of
data in matching order with a little code.

On Fri, Aug 6, 2010 at 1:34 PM, owidjaya  wrote:

> is there a way that i can get the a list of dictionaries as a result
> with the dictionary having the same field order as the table?
>
> On Aug 6, 10:18 am, Daniel Roseman  wrote:
> > On Aug 6, 6:08 pm, owidjaya  wrote:
> >
> > > I checked it and the field order still not the same.
> > > Just to clarify. I want the to do this A.objects.all().values()
> > > and still get the each list in the result to have the same "field
> > > order" as the database table defined.
> >
> > `values()` returns a set of dictionaries. Dictionaries are unordered
> > by definition.
> >
> > `values_list()` returns a set of tuples, which should be in the same
> > order as the model definition, however you don't get the fieldnames.
> > --
> > 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-us...@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-us...@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: confusing query involving time ranges

2010-08-12 Thread Alec Shaner
Hopefully some django sql guru will give you a better answer, but I'll take
a stab at it.

What you describe does sound pretty tricky. Is this something that has to be
done in a single query statement? If you just need to build a list of
objects you could do it in steps, e.g.:

# Get all State objects that span the requested dt
q1 = State.objects.filter(first_dt__lte=dt, last_dt__gte=dt)

# Get all State objects where foo is not already in q1, but have a last_dt
prior to requested dt
q1_foo = q1.values_list('foo')
q2 =
State.objects.exclude(foo__in=q1_foo).filter(last_dt__lt=dt).order_by('-last_dt')

But q2 would not have unique foo entries, so some additional logic would
need to be applied to get the first occurrence of each distinct foo value in
q2.

Probably not the best solution, but maybe it could give you some hints to
get started.

On Thu, Aug 12, 2010 at 12:51 PM, Emily Rodgers <
emily.kate.rodg...@gmail.com> wrote:

> Hi,
>
> I am a bit stuck on this and can't seem to figure out what to do.
>
> I have a model that (stripped down for this question) looks a bit like
> this:
>
> class State(models.Model):
>first_dt = models.DateTimeField(null=True)
>last_dt = models.DateTimeField(null=True)
>foo = models.CharField(FooModel)
>bar = models.ForeignKey(BarModel, null=True)
>meh = models.ForeignKey(MehModel, null=True)
>
> This is modeling / logging state of various things in time (more
> specifically a mapping of foo to various other bits of data). The data
> is coming from multiple sources, and what information those sources
> provide varies a lot, but all of them provide foo and a date plus some
> other information.
>
> What I want to do, is given a point in time, return all the 'states'
> that span that point in time. This seems trivial except for one thing
> - a state for a particular 'foo' may still be persisting after the
> last_dt until the next 'state' for that 'foo' starts. This means that
> if there are no other 'states' between the point in time and the start
> of the next state for a given foo, I want to return that state.
>
> I have built a query that kindof explains what I want to do (but
> obviously isn't possible in its current form):
>
> dt = '2010-08-12 15:00:00'
>
> lookups = State.objects.filter(
>Q(
>Q(first_dt__lte=dt) & Q(last_dt__gte=dt) |
>Q(first_dt__lte=dt) &
>
> Q(last_dt=State.objects.filter(foo=F('foo')).filter(first_dt__lte=dt).latest('last_dt'))
>)
> )
>
> I know this doesn't work, but I think it illustrates what I am trying
> to do better than words do.
>
> Does anyone have any advice? Should I be using annotate or something
> to show what the last_dt for each foo is? I might be being really
> stupid and completely missing something but I have been trying to
> figure this out for too long!
>
> Cheers,
> Emily
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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 evaluation problem

2010-08-16 Thread Alec Shaner
Regarding your issue with get_next, could be because you're invoking the
method when you define default=get_next(). Try it with just the bare method
name get_next.

You could also use the aggregate function instead of creating a new model:

http://docs.djangoproject.com/en/1.2/topics/db/aggregation/#topics-db-aggregation

Just define get_next to call the Max aggregate on your Newspaper model's
number field.

On Mon, Aug 16, 2010 at 12:39 PM, bagheera  wrote:

> Hi, i have "number" field in "newspaper" model.  I want assign to it
> dynamically a default value, witch would be a incremented by 1 highest value
> so far.
> So i managed to make a little workaround, since i can't query for last
> value of "number" field of model from model itself.
>
> I have created new model, witch has only 1 field any 1 record, witch stores
> current highest value.
> I wrote two functions:
>
>
> #-*- coding: utf-8 -*-
> from nml.options.models import Wydanie_opt
>
> def set_next(value):
>try:
>option = Wydanie_opt.objects.all()[0]
>if value > option.nr_wydania_next:
>option.nr_wydania_next = value
>option.save()
>except:
>option = Wydanie_opt(nr_wydania_next = value)
>option.save()
>
> def get_next():
>try:
>option = Wydanie_opt.objects.all()[0]
>value = option.nr_wydania_next
>except:
>return 0
>else:
>return value + 1
>
> Here's code of "newspaper" model:
>
>
> from nml.options.utils import get_next
>
>
> class Wydanie(models.Model):
>nr_wydania = models.PositiveIntegerField(verbose_name = "Numer wydania",
> unique = True, default = get_next(),
>help_text = "Unikalny numer wydania.")
>
> The problem is, set_next is working as intended, but get_next() does NOT,
>  default value stays the same until i restart dev server. Why? Query isn't
> evaluated? get_next() function isn't called at all?
> Mb there is a better way to implement auto-incrementation.
> Keep in mind that, "nr_wydania" field must be visible and editable, since
> first entered value is unknown, some values may be skipped, and there is no
> order of adding it.
> --
> Linux user
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: select statements with specific fields across multiple tables...

2010-08-16 Thread Alec Shaner
1. What is your code for doing the filters?  If you want to start with
physical drives it would be something like:

RaidPhysicalDrive.objects.filter(in_array__in_storage__in_system__id=)

2. In your template you've referenced pd.in_array_id, but don't you just
want pd.in_array if you're wanting to follow the FK to get RaidArray fields,
e.g.,

{{ 
pd.in_array.in_storage.in_system.name}}


On Mon, Aug 16, 2010 at 8:04 PM, Cindy  wrote:

> I'm having some trouble constructing a filter that's intended to work
> across multiple tables with selected fields.  Here's a simplified
> outline of my models:
>
> class System(models.Model):
>name = models.CharField(max_length=16)
>domain = models.CharField(max_length=255, default='example.com')
>
> class RaidStorage(models.Model):
>in_system = models.ForeignKey(System)
>name = models.CharField(max_length=25)
>
> class RaidArray(models.Model):
>in_storage = models.ForeignKey(RaidStorage)
>name = models.CharField(max_length=25)
>
> class RaidPhysicalDrive(models.Model):
>in_array = models.ForeignKey(RaidArray)
>name = models.CharField(max_length=25)
>size = models.IntegerField(null=True, blank=True)
>serial = models.CharField(max_length=25)
>model = models.CharField(max_length=25)
>
> Now, given a system id, I want to list all the physical drives from it
> along with info from the related tables.  I would like something like
>
> select System.name, RaidStorage.name, RaidArray.name,
> RaidPhysicalDrive.name, RaidPhysicalDrive.serial,
> RaidPhysicalDrive.model from System, RaidStorage, RaidArray,
> RaidPhysicalDrive where RaidPhysicalDrive.in_array=RaidAarray.id and
> RaidArray.in_storaage = RaidStorage.id and RaidStorage.in_system=id
> (etc)
>
> I'm having a good deal of trouble coming up with the filters for
> this.  I'm thinking that .values() and possibly .select_related() are
> key here, but so far I've failed at putting together anything that
> gives me the results I want (a list of physical drives associated with
> the selected system).   The filter examples through the tutorials and
> such seem to all assume select *, and there's very little on dealing
> with grouping selective fields from multiple tables that I've found.
>
> Part of the issue might be in the template as well; If I cheat and
> send it the correct list, I can't access part of the information I
> want:
>
> {% for pd in pd_list %}
> 
>{{ pd.in_array_id.storage.in_system.name }}
>{{ pd.in_array_id.in_storage.name }}
>{{ pd.in_array_id.name }}
>{{ pd.name }}
>{{ pd.serial }}
>{{ pd.model }}
> 
> {% endfor %}
>
> results in the first three columns of the table being empty...
> templates don't seem to "follow" back the way they do in views.py,
> etc.  So I'm sure I need to create a dictionary or list from the
> original views.py def to pass to the template but as I say, I'm not
> sure of how to use .values or .select_related (or whatever else item
> I'm overlooking).
>
> I did search through the group a bit, but didn't find anything
> directly helpful.
>
> Thanks!
> --Cindy
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: flatpages and menu

2010-08-24 Thread Alec Shaner
You could use a context processor to read the flatpage table to build the
menu. If you want more control over the menu then create a Menu model and
store the flatpage links there and again build the menu in a context
processor. You would probably want to use some level of caching if you don't
want to hit the database for every page view.

On Tue, Aug 24, 2010 at 3:00 AM, OliverMarchand
wrote:

> Dear all,
>
> I am thinking of creating a website that displays "mostly" database
> content, but for special content I am using flatpages. Now somehow I
> must put a link to the flatpages somewhere, most likely in a menu. If
> I put the menu in my base template, then there is no way to insert
> this link by editing.
>
> Do you have a good design idea to make the menu editable as well?
>
> thanks and cheers,
> Oliver
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Finding current view url in template?

2010-08-24 Thread Alec Shaner
You could set a context variable, e.g., listing_operation = 'Edit' or
'Create'. Or you could use different templates, each inheriting a common
template and only doing minor tweaks.

On Tue, Aug 24, 2010 at 9:04 AM, reduxdj  wrote:

> I have some decisions i need to make in my template based on the view
> that has been rendered in the browser.
>
> For instance:
>
> I need to know if the user is on gather.view.create_listing or
> gather.view.edit_listing?
>
> How can I do this in django, it alludes me.
>
> Thanks,
> Patrick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Please wait page trouble

2010-08-31 Thread Alec Shaner
Rolando's suggestion is a pretty straight forward method to achieve what you
want. You probably need to elaborate where in the process you're having
trouble (although based on your response maybe it's the first step?). You
can indeed call a view.my function from your please wait template, but you
want to do it in the background, i.e., with an AJAX request in order to keep
the Please Wait message displayed while your server processes the request.

On Tue, Aug 31, 2010 at 2:46 PM, Bradley Hintze  wrote:

> I'm getting no where with this, are there any other suggestions on row
> to render a 'please wait' page while other python works? Can I call a
> view.my function to run from my 'please wait' template?
>
> Please be as elementary as possible as javascript, AJAX, jquery, and
> the like are brand new to me.
>
> Thanks,
> Bradley
>
> On Tue, Aug 31, 2010 at 10:38 AM, Bradley Hintze
>  wrote:
> > I'll look into this. I have no idea what you mean by 'ajax' or 'json'.
> > Thus your code doe'snt really make sense given my lack of knowlege. I
> > will do some googling to see if I can piece it together. Thanks for
> > the help!
> >
> > On Mon, Aug 30, 2010 at 10:37 PM, Rolando Espinoza La Fuente
> >  wrote:
> >> On Mon, Aug 30, 2010 at 7:18 PM, Bradley Hintze
> >>  wrote:
> >>> I am attempting to do a lengthe calculation that will require the user
> >>> to wait a bit. I want a 'Please wait page to come up while the lengthy
> >>> calculation is performed. I thought this might work:
> >>>
> >>> views.py
> >>>
> >>> def please_wait(request):
> >>>return HttpResponse('Please Wait..')
> >>>
> >>> def run_DHM(request):
> >>>please_wait(request)
> >>>lengthy calculations...
> >>>
> >>> This did not show the 'Please Wait' page. Is there a better way to do
> >>> what I am trying to do?
> >>>
> >>
> >> You are not returning the HttpResponse object from please_wait(). But
> anyway,
> >> doesn't work that way. At least with django.
> >>
> >> What you can do is render a normal html with the message "Please wait",
> >> then perform an ajax call to start the calculations and finally return
> >> a json response
> >> to display the result in the client-side.
> >>
> >> Roughly:
> >>
> >> def please_wait(request):
> >># ... setup context or something
> >>return render_to_response("please_wait.html")
> >>
> >> def run_DHM(request)
> >># ... perform calculations and collect the result in a dict
> >>data = {"result": something}
> >>return HttpResponse(json.dumps(data), mimetype="application/json")
> >>
> >>
> >> # using jquery in your html
> >> 
> >> $.getJSON("/run_DHM/", function(data) {
> >>// do something with result
> >>console.log(data.result);
> >> });
> >> 
> >>
> >>
> >> Rolando Espinoza La fuente
> >> www.insophia.com
> >>
> >>> --
> >>> Bradley J. Hintze
> >>> Graduate Student
> >>> Duke University
> >>> School of Medicine
> >>> 801-712-8799
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> >>> To post to this group, send email to django-us...@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-us...@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.
> >>
> >>
> >
> >
> >
> > --
> > Bradley J. Hintze
> > Graduate Student
> > Duke University
> > School of Medicine
> > 801-712-8799
> >
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Please wait page trouble

2010-08-31 Thread Alec Shaner
$.getJSON should be embedded in your initial Page Wait response page. The
first argument isn't a view, rather a URL. So you might want to use the
django url template tag, e.g.,

$.getJSON('{% url whatever.run_DHM %}', ...)

The second argument is a callback function. The browser stores the callback
and subsequently calls it when the url requested returns a response. It also
might be confusing because the function is defined inline (anonymous), which
is a frequent shortcut used in javascript. But anyway, when the callback
function executes he just put console.log(result.data) as way to see what
gets returned.

 You say you want to send the user to another page with the results, but you
could return a rendered chunk of html code and replace the Please Wait
message using jquery to mainupulate the DOM (jquery documentation has
tutorials). Or if you want to redirect to a new page you could store the
calculation results in the session and redirect to a view that pulls from
that same session data (or use memcached). So maybe instead of
console.log(result.data), you could use
window.location="/some/url/to/show/calculations/";

His example returns a HttpResponse just to illustrate the concept of how to
return JSON data. You don't have to return JSON, but it's a good method if
you want to return structured data. In the above example of a redirect you
could just return anything I suppose, i.e., just an 'OK'.

On Tue, Aug 31, 2010 at 5:11 PM, Bradley Hintze  wrote:

> Ok, I'll try to elaborate. again java is foreign to me although I've
> spent all day trying to learn some.
>  Here's the code:
>
> def please_wait(request):
>   # ... setup context or something
>   return render_to_response("please_wait.html")
>
> def run_DHM(request)
>   # ... perform calculations and collect the result in a dict
>   data = {"result": something}
>   return HttpResponse(json.dumps(data), mimetype="application/json")
>
>
> # using jquery in your html
> 
> $.getJSON("/run_DHM/", function(data) {
>   // do something with result
>   console.log(data.result);
> });
> 
>
> def run_DHM(request) is straight forward then it falls apart.
>
> $.getJSON("/run_DHM/", function(data) {
>   // do something with result
>   console.log(data.result);
> });
>
> I presume that '$.getJSON("/run_DHM/", function(data)' somehow runs
> the run_DHM function? How can it even find the function since it lives
> in view.py? '// do something with result' I want to send another
> page to the client with the results but do I do this here? If not,
> what do I do here? What does 'console.log(data.result);' do? Why does
> def run_DHM(request) return a HttpResponse? I have a template I want
> it to return so shouldn't I use render_to_response? Obviously, I am
> not getting how the javascript works so I have no idea how to set this
> up. I was hoping there was a pythonic solution :).
>
> I hope this explains my utter confusion sufficiently.
>
> Bradley
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Discrepancy between model formset and the queryset it's based on

2010-09-01 Thread Alec Shaner
Perhaps see:

http://docs.djangoproject.com/en/1.2/topics/forms/formsets/

where it talks about the "extra" keyword that controls how many blank forms
to add, the default is 1


On Wed, Sep 1, 2010 at 5:31 PM, ses1984  wrote:

> Basically I have a queryset with N items in it, which I use to create
> a model formset, which then has N+1 items in it. I'm not sure why this
> is happening.
>
> Here is a summary of the problem. Please forgive my crude methods for
> gathering information (if anyone has feedback on that topic, I would
> like to hear it)
>
> http://dpaste.com/hold/237587/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Please wait page trouble

2010-09-07 Thread Alec Shaner
You need to include the jquery library script in your html page if you're
calling getJSON as in the previous emails (and note that getJSON isn't
necessarily the function you want - jquery provides many options for doing
AJAX). Either download it, or use one of the public repositories:

http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery

In fact, just view the html source code for the link just referenced -
you'll see how jquery is included:

http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</a>
<view-source:<a  rel="nofollow" href="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</a>>">

Then I'd recommend one of the tutorials, e.g.,:

http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery

The tutorials should serve as live examples.

On Tue, Sep 7, 2010 at 10:31 AM, Bradley Hintze  wrote:

> It seems as if this is the only solution but after a week of trying to
> implement it in a variety of ways it won't work. is there something I
> need to download (jquery)? More helpful would be a real HTML page as
> an example or a live example on the web. I am sorry for the trouble
> but I'd like to understand this and get it working.
>
> On Tue, Aug 31, 2010 at 7:37 PM, Alec Shaner 
> wrote:
> > $.getJSON should be embedded in your initial Page Wait response page. The
> > first argument isn't a view, rather a URL. So you might want to use the
> > django url template tag, e.g.,
> > $.getJSON('{% url whatever.run_DHM %}', ...)
> > The second argument is a callback function. The browser stores the
> callback
> > and subsequently calls it when the url requested returns a response. It
> also
> > might be confusing because the function is defined inline (anonymous),
> which
> > is a frequent shortcut used in javascript. But anyway, when the callback
> > function executes he just put console.log(result.data) as way to see what
> > gets returned.
> >  You say you want to send the user to another page with the results, but
> you
> > could return a rendered chunk of html code and replace the Please Wait
> > message using jquery to mainupulate the DOM (jquery documentation has
> > tutorials). Or if you want to redirect to a new page you could store the
> > calculation results in the session and redirect to a view that pulls from
> > that same session data (or use memcached). So maybe instead of
> > console.log(result.data), you could
> > use window.location="/some/url/to/show/calculations/";
> > His example returns a HttpResponse just to illustrate the concept of how
> to
> > return JSON data. You don't have to return JSON, but it's a good method
> if
> > you want to return structured data. In the above example of a redirect
> you
> > could just return anything I suppose, i.e., just an 'OK'.
> >
> > On Tue, Aug 31, 2010 at 5:11 PM, Bradley Hintze
> >  wrote:
> >>
> >> Ok, I'll try to elaborate. again java is foreign to me although I've
> >> spent all day trying to learn some.
> >>  Here's the code:
> >>
> >> def please_wait(request):
> >>   # ... setup context or something
> >>   return render_to_response("please_wait.html")
> >>
> >> def run_DHM(request)
> >>   # ... perform calculations and collect the result in a dict
> >>   data = {"result": something}
> >>   return HttpResponse(json.dumps(data), mimetype="application/json")
> >>
> >>
> >> # using jquery in your html
> >> 
> >> $.getJSON("/run_DHM/", function(data) {
> >>   // do something with result
> >>   console.log(data.result);
> >> });
> >> 
> >>
> >> def run_DHM(request) is straight forward then it falls apart.
> >>
> >> $.getJSON("/run_DHM/", function(data) {
> >>   // do something with result
> >>   console.log(data.result);
> >> });
> >>
> >> I presume that '$.getJSON("/run_DHM/", function(data)' somehow runs
> >> the run_DHM function? How can it even find the function since it lives
> >> in view.py? '// do something with result' I want to send another
> >> page to the client with the results but do I do this here? If not,
> >> what do I do here? What does 'console.log(data.result);' do? Why does
> >> def run_DHM(request) return a HttpResponse? I have a template I want
> >> it to return so shouldn't I use

Re: Please wait page trouble

2010-09-09 Thread Alec Shaner
Could you post the full url.py file?

And as Brian mentioned your javascript block should be separated. Plus you
have an extra }); that's going to fail once you resolve this reverse error.
It's also not clear what you intend to happen when run_DHM returns its
response? It looks like your intent is to do a redirect and run_DHM will use
session data to retrieve calculation results.

Just to clarify, I think your plan is to:

1. Display a Please Wait page that fires off an AJAX call to some view that
performs calculations => run_DHM. The results of the calculations are stored
in the session.
2. run_DHM returns a simple response that will indicate sucess, e.g., "OK"
3. Redirect to a view to display the results, which are retrieved from the
session => display_DHM

I think you need three views here: please_wait, run_DHM, and display_DHM.

On Thu, Sep 9, 2010 at 8:45 AM, Bradley Hintze
wrote:

> #url.py
> ...
>(r'^please_wait/', please_wait),
>(r'^DHM_run/$', run_DHM),
> ...
>
> #please_wait.html
>
>  src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";>
> $.getJSON('{% url run_DHM %}')
> });
> 
>
> #view.py
> def please_wait(request):
>c = {'we_r_home':'yes'}
>return render_to_response('please_wait.html', c)
>
> def run_DHM(request):
> //put calculated data in request.session
>return render_to_response('DHM_ran.html', request.session,
> context_instance=RequestContext(request))
>
>
> This is the django error
>
> Caught NoReverseMatch while rendering: Reverse for 'run_DHM' with
> arguments '()' and keyword arguments '{}' not found.
>
> run_DHM takes 'request' as an argument. How do I pass it the argument??
>
> Bradley
>
> On Wed, Sep 8, 2010 at 9:34 PM, Brian Neal  wrote:
> > On Sep 8, 5:56 pm, Bradley Hintze  wrote:
> >> This is what I have in my please_wait.html
> >>
> >>  >> src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";>
> >> $.getJSON('{% url run_DHM %}')});
> >>
> >> 
> >
> > I don't think that is right, is it? At least I've never seen it done
> > that way. I think you need two script tags:
> >
> > http://ajax.googleapis.com/ajax/
> > libs/jquery/1.4/jquery.min.js">
> > 
> >   // Your javascript goes here...
> > 
> >
> >>
> >> This is the django error
> >>
> >> Caught NoReverseMatch while rendering: Reverse for 'run_DHM' with
> >> arguments '()' and keyword arguments '{}' not found.
> >>
> >> run_DHM takes 'request' as an argument. How do I pass it the argument??
> >>
> >
> > All views take request as a first argument. But that isn't the
> > problem. Please post your urls.py that has your run_DHM view in it.
> >
> > Regards,
> > BN
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
> >
>
>
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Please wait page trouble

2010-09-09 Thread Alec Shaner
I feel your pain - javascript has always been a pain for me, but libraries
like jQuery make it more bearable!

AJAX calls are made in the background (usually asynchronously), so they
don't directly change the page you're currently viewing in your browser. The
browser is responsible for dispatching the response returned from your AJAX
call, typically by invoking a callback function you specified when the AJAX
request was initiated. So you don't do a redirect from the server, rather
you can do it using client side javascript in your callback function.

Here is how it basically works:
1. Please Wait page makes AJAX request to run_DHM, specifies callback
function when request completes.
2. run_DHM performs calculations, stores results in session, returns an "OK"
response.
3. Browser invokes the callback function specified in step 1, which should
change the page to display_DHM view.
4. display_DHM retrieves calculation results from session and renders HTML
page.

Your first problem is with the url template tag. You might try this:

{% url MolProbity_Compare_test.views.run_DHM %}

You can also use a named urls, e.g.,
...
url(r'^DHM_run/$', run_DHM, name="run_DHM"),
...
in which case {% url run_DHM %} should also work

Or you can just call the url directly instead of using the url template tag,
e.g., '/run_DHM/'.

The request argument is always passed to your views, you don't have to do it
explicitly. So your run_DHM and display_DHM views will always have that
available. Just get the session out of the request object in each view you
need it.

Basic skeleton:

# please_wait.html
...
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"</a>;>

$.get('{% url run_DHM %}', function(data) {
if (data == 'OK') {
  window.location.href = '{% url display_DHM %}';
} else {
  alert(data);
}
});


Note I've used the shorthand urls above, you could just use '/run_DHM/' and
'/display_DHM/' instead of the url template tags. You could also use the
full package path. Also note that the callback function I refer to is
defined inline - the function(data) ... part.

# views.py
from django.http import HttpResponse

def please_wait(request):
return render_to_response('please_wait.html', ...)

def run_DHM(request):
# Do calculations, store results in request.session
...
# If everything ok, return OK (otherwise return some error)
return HttpResponse('OK')

def display_DHM(request):
# Get results from session
return render_to_response('ran_DHM.html', ...)

This is over simplified, but should serve to get started if you want to use
this redirect approach.

On Thu, Sep 9, 2010 at 9:59 AM, Bradley Hintze
wrote:

> Alec,
>
> Thanks for your patience. The jquery tutorials have been frustrating.
> Anyway, I do not have three 'views' as you suggested. I will try that.
> But I need to understand a few things before I try that. How to call
> run_DHM from my please_wait.html page. (I assume AJAX but I've tried
> and tries what have been suggested with no success, most likely due to
> my failed attempts at understanding AJAX) I assume after I run the
> run_DHM view function I will somehow have run_DHM redirect it to the
> display_DHM. My question is, how do I redirect AND pass the
> request.session arguments, which is where the data from run_DHM will
> be stored?
>
> As requested, here is my full url.py:
>
> from django.conf.urls.defaults import *
> from MolProbity_Compare_test.views import *
>
> # Uncomment the next two lines to enable the admin:
> # from django.contrib import admin
> # admin.autodiscover()
>
> urlpatterns = patterns('',
>(r'^home/$', home_view),#the 'index' or home or top page view
>(r'^about/$', about_view),
>(r'^log_out_confirm/$', log_out_confirm),
>(r'^log_out/$', log_out),
>(r'^upload/$', uploaded_PDBs),
>(r'^rotamer_diff/$', rotamer_dif_frame),
>(r'^side-by-side/$', side_by_side),
>(r'^side-by-side-key/$', side_by_side_key),
>(r'^side-by-side-frame/$', side_by_side_frame),
> (r'^DHM_run/$', run_DHM),
>(r'^please_wait/', please_wait),
> (r'^analyze/$', analyze_compare),
> )
>
>
> On Thu, Sep 9, 2010 at 9:22 AM, Alec Shaner  wrote:
> > Could you post the full url.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-us...@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: Please wait page trouble

2010-09-09 Thread Alec Shaner
That's really a design issue up to you, i.e., how you get data from your
view to your template. Since I don't know the format or how much data you're
storing in the session it's hard to say. I was just assuming you'd use
context variable(s) to pass the data to the template. I'm not intimately
familiar with the Session API, but isn't it just a dictionary?

On Thu, Sep 9, 2010 at 11:05 AM, Bradley Hintze  wrote:

> Thanks Alec,
>
> That finally makes sense. However, I do have a question here:
>
> def display_DHM(request):
># Get results from session
>return render_to_response('ran_DHM.html', ...)
>
> '# Get results from session' Would I not just do this:
>
> def display_DHM(request):
>return render_to_response('DHM_ran.html', request.session, ...)
>
> Or do I have to explicitly get the session data? If so, how?
>
>
> On Thu, Sep 9, 2010 at 10:37 AM, Alec Shaner 
> wrote:
> > I feel your pain - javascript has always been a pain for me, but
> libraries
> > like jQuery make it more bearable!
> >
> > AJAX calls are made in the background (usually asynchronously), so they
> > don't directly change the page you're currently viewing in your browser.
> The
> > browser is responsible for dispatching the response returned from your
> AJAX
> > call, typically by invoking a callback function you specified when the
> AJAX
> > request was initiated. So you don't do a redirect from the server, rather
> > you can do it using client side javascript in your callback function.
> >
> > Here is how it basically works:
> > 1. Please Wait page makes AJAX request to run_DHM, specifies callback
> > function when request completes.
> > 2. run_DHM performs calculations, stores results in session, returns an
> "OK"
> > response.
> > 3. Browser invokes the callback function specified in step 1, which
> should
> > change the page to display_DHM view.
> > 4. display_DHM retrieves calculation results from session and renders
> HTML
> > page.
> >
> > Your first problem is with the url template tag. You might try this:
> >
> > {% url MolProbity_Compare_test.views.run_DHM %}
> >
> > You can also use a named urls, e.g.,
> > ...
> > url(r'^DHM_run/$', run_DHM, name="run_DHM"),
> > ...
> > in which case {% url run_DHM %} should also work
> >
> > Or you can just call the url directly instead of using the url template
> tag,
> > e.g., '/run_DHM/'.
> >
> > The request argument is always passed to your views, you don't have to do
> it
> > explicitly. So your run_DHM and display_DHM views will always have that
> > available. Just get the session out of the request object in each view
> you
> > need it.
> >
> > Basic skeleton:
> >
> > # please_wait.html
> > ...
> >  > src="<a  rel="nofollow" href="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</a>
> ">
> > 
> > $.get('{% url run_DHM %}', function(data) {
> > if (data == 'OK') {
> >   window.location.href = '{% url display_DHM %}';
> > } else {
> >   alert(data);
> > }
> > });
> > 
> >
> > Note I've used the shorthand urls above, you could just use '/run_DHM/'
> and
> > '/display_DHM/' instead of the url template tags. You could also use the
> > full package path. Also note that the callback function I refer to is
> > defined inline - the function(data) ... part.
> >
> > # views.py
> > from django.http import HttpResponse
> >
> > def please_wait(request):
> > return render_to_response('please_wait.html', ...)
> >
> > def run_DHM(request):
> > # Do calculations, store results in request.session
> > ...
> > # If everything ok, return OK (otherwise return some error)
> > return HttpResponse('OK')
> >
> > def display_DHM(request):
> > # Get results from session
> > return render_to_response('ran_DHM.html', ...)
> >
> > This is over simplified, but should serve to get started if you want to
> use
> > this redirect approach.
> >
> > On Thu, Sep 9, 2010 at 9:59 AM, Bradley Hintze <
> bradle...@aggiemail.usu.edu>
> > wrote:
> >>
> >> Alec,
> >>
> >> Thanks for your patie

Re: Please wait page trouble

2010-09-09 Thread Alec Shaner
A lot of ways to do this. Yes you could do it as above, but that can get
ugly as you start adding more views. You can indeed access the context
dictionary in please_wait.html. It's hard to say without knowing more
details about your application. How does the user pass arguments (if any)
used in these calculations? If you're looking for a simple way to abstract
this process, consider using URL confs:

# Create a url specific to the DHM calulcation
url(r'^DHM_run_start/$', please_wait, kwargs={'calculation_url': 'run_DHM'},
name='run_DHM_start'),

and you'd call it like /DHM_run_start/

or

# Create a URL with a regex pattern to capture a calculation_url
url(r'^please_wait/(?P[\d\w]+)/$', please_wait),

and you'd call it like /please_wait/run_DHM/

The second option is more generic, but you'll need to validate the url
argument. The first option means adding more url entries. In either case
your please_wait view would be defined like:

def please_wait(request, calculation_url):
return render_to_response('please_wait.html', {'calculation_url':
calculation_url}, ...)

please_wait.html could then substitute the {{ calculation_url }} context
variable as the argument to the {% url %} tag.

Your run_DHM view could now return the url to redirect to instead of just
'OK'. You'll have to return the full URL, e.g., '/display_DHM/', from your
run_DHM view. This is probably where you'd start thinking about a JSON
response as you might return a dictionary with an result code ('OK' or
'error') along with a url to redirect the user to.

window.location.href = data;

Or if you've switched to a JSON response it might be data.display_url after
checking that data.result = 'OK'.

Hope that all makes sense.

On Thu, Sep 9, 2010 at 12:00 PM, Bradley Hintze  wrote:

> OK,
>
> Got it working. Sorry one more question. I have a couple of places
> where I'd like to display the 'Please Wait' page. I'd imagine I'd do
> something similar to the following::
>
> # please_wait.html
> ...
>  src="<a  rel="nofollow" href="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</a>
> ">
> 
> if (If_come_from_pageA) {
> $.get('{% url run_DHM %}', function(data) {
>if (data == 'OK') {
>  window.location.href = '{% url display_DHM %}';
>} else {
>  alert(data);
>}
>}
> else if (If_come_from_pageB) {
>$.get('{% url run_analysis %}', function(data) {
>if (data == 'OK') {
>  window.location.href = '{% url display_analysis %}';
>} else {
>  alert(data);
>}
>}
>});
> 
>
> an of course configure url.py and view.py as explained previously. Is
> there an easy way to do this? In other words, what are the
> If_come_from_pageA and If_come_from_pageB conditions? Can I access the
> context dictionary that I passed to please_wait.html?
>
> On Thu, Sep 9, 2010 at 11:23 AM, Bradley Hintze
>  wrote:
> > Yeah, I just tried out what I wrote in my last and it worked!
> >
> > Thanks for all your help!!!
> >
> > Bradley
> >
> > On Thu, Sep 9, 2010 at 11:17 AM, Alec Shaner 
> wrote:
> >> That's really a design issue up to you, i.e., how you get data from your
> >> view to your template. Since I don't know the format or how much data
> you're
> >> storing in the session it's hard to say. I was just assuming you'd use
> >> context variable(s) to pass the data to the template. I'm not intimately
> >> familiar with the Session API, but isn't it just a dictionary?
> >>
> >> On Thu, Sep 9, 2010 at 11:05 AM, Bradley Hintze
> >>  wrote:
> >>>
> >>> Thanks Alec,
> >>>
> >>> That finally makes sense. However, I do have a question here:
> >>>
> >>> def display_DHM(request):
> >>># Get results from session
> >>>return render_to_response('ran_DHM.html', ...)
> >>>
> >>> '# Get results from session' Would I not just do this:
> >>>
> >>> def display_DHM(request):
> >>>return render_to_response('DHM_ran.html', request.session, ...)
> >>>
> >>> Or do I have to explicitly get the session data? If so, how?
> >>>
> >>>
> >>> On Thu, Sep 9, 201

Re: Please wait page trouble

2010-09-10 Thread Alec Shaner
Excellent. Glad you got it working.

On Fri, Sep 10, 2010 at 8:54 AM, Bradley Hintze  wrote:

> I got to work! I needed a good nights sleep to see it. the url was
> '/DHM_run/' NOT '/run_DHM/'.
>
> Thanks Alec
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: db filter comparing a minimum to a range

2010-09-13 Thread Alec Shaner
Maybe this is what you want:

http://docs.djangoproject.com/en/1.2/topics/db/aggregation/#filtering-on-annotations

On Mon, Sep 13, 2010 at 3:32 PM, Phlip  wrote:

> Djangoids:
>
> Consider this QuerySet:
>
>   Blog.objects.filter(comment__date__range=(self.yesterday,
> self.tomorrow))
>
> It returns all the blogs with any comment (as a side note, it seems to
> return each blog redundantly, to allow the SELECT to differ each
> returned row by comment).
>
> I need every Blog whose first comment appears in the date range:
>
> SELECT * FROM blog
>  INNER JOIN comment ON comment.blog_id = blog.id
> WHERE MIN(comment.date) BETWEEN '2010-09-12' AND '2010-09-14'
> GROUP BY(blog.id)
>
> Can I get that without dropping to raw SQL?
>
> --
>  Phlip
>  http://zeekland.zeroplayer.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-us...@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-us...@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: Querying Exact Foreign Key Sets

2010-09-15 Thread Alec Shaner
Try this:

I'm assuming you define Article.category as a ManyToMany field? I also
assumed for the example that Category has a name field.

# Build a queryset of all categories not in desired set, e.g., 'Exact1' and
'Exact2'
bad_categories = Category.objects.exclude(category_name__in=['Exact1',
'Exact2'])
# Filter your exact categories, then exclude the bad ones
Article.objects.filter(category__name='Exact1').filter(category__name='Exact2').exclude(category__in=bad_categories)


On Tue, Sep 14, 2010 at 5:58 PM, Jason  wrote:

> Say for example you have two models:
>
> Article
> Category
>
>
> Articles can have multiple categories.
>
> How would you go about finding the Articles that contain only a
> certain set of Categories?
>
> The 'in' operator doesn't do me any good. Excludes look like they are
> needed...
>
>
> I'm in a situation where quickly sorting by SETS of categories is
> needed and I'm having a tough time. My database programming skills are
> pretty weak.
>
> I'm thinking of making an intermediate model called CategorySets.
>
> Articles would then have a relationship to a CategorySet and I can
> sort very easily on this.
>
>
> (note my actual project isn't using Articles but it's quicker to
> explain in these terms).
>
> Does anyone have any tips or experience here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Bug in model inheritance?

2010-09-28 Thread Alec Shaner
As to whether it's a bug or not I have no idea, though it seems so.

If you use:

entity = models.OneToOneField(Entity, parent_link=True, primary_key=True)

it will create the primary key in both Kid and Adult tables, which
sounds like what you want?

On Tue, Sep 28, 2010 at 1:06 PM, phill  wrote:
> This looks quite a bit like a bug, but we may be off the reservation
> in terms of how we're using the product. (Disclaimer: I'm relatively
> new to Django, and extremely new to the codebase that I ran into this
> on).
>
> We've got a form of schema-inheritance going on in this project in
> order to accomplish shared-id-space and the ability to relate models
> to one of a number of different types. The way that we've broken it
> out runs us into a strange inconsistency in Django that specifically
> affects our ability to serialize the objects. Here's a simplified
> version of what we're doing:
>
> class Entity(models.Model):
>    entityType = models.CharField(editable=False,max_length=50)
>
>    def __init__(self, *args, **kwargs):
>        super(Entity, self).__init__(*args, **kwargs)
>        self.entityType = self.__class__.__name__
>
>    def __unicode__(self):
>        return 'Entity: %s %s' %(self.entityType, self.id)
>
> class BasePerson(Entity):
>
>    entity = models.OneToOneField(Entity, parent_link=True)
>    name = models.CharField(max_length=50)
>
>    class Meta:
>        abstract = True
>
> class Kid(BasePerson):
>    school = models.CharField(max_length=50)
>
> class Adult(BasePerson):
>    job = models.CharField(max_length=50)
>
>
>
> When I dump instances of these models out using the standard fixtures
> serialization, instances of Kid will serialize the 'entity' field, but
> instances of Adult won't. The reason is because Adult's entity field
> is marked primaryKey=True. Kid's is not. There appears to be a caching
> issue here, because if I swap the order that Kid and Adult are defined
> in.. the error reverses (now Kid's field will be marked pk).
>
> Is this a bug? If not, what's the reasoning behind this behavior? Is
> there a better pattern for accomplishing this kind of inheritance?
>
> Thanks in advance for your help.
>
> Phill
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Why Django Admin Won't Display full graphics

2010-09-30 Thread Alec Shaner
Also, if you're using mod_wsgi (recommended over mod_python), see this:

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango


On Thu, Sep 30, 2010 at 12:12 PM, Addy Yeow  wrote:
> runserver takes care of thing like this for you but you need to handle
> it properly in Apache.
> See 
> http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#serving-the-admin-files
>
> On Fri, Oct 1, 2010 at 12:03 AM, octopusgrabbus
>  wrote:
>>
>> When I run Django admin with runserver running, I get nice graphics. I
>> don't when I run Django admin from apache. I can log into my django
>> application from apache, but do not get the graphics. I'm looking for
>> examples or documentation on how to fix this.
>>
>> Thanks.
>> cmn
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@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-us...@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-us...@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: treating different versions of website urls as one

2010-10-05 Thread Alec Shaner
Definitely sounds like a regular expression is what you need.

Not sure what you mean by etcare you saying any variation of a web
address for mysite.com, i.e., with or without www prefix, with our
without protocol http://, and with our without the index page, which
itself could be any variation of index.html, index.php, or
index.whatever?

On Tue, Oct 5, 2010 at 12:17 PM, harryos  wrote:
> hi
> I am trying out a web app where it needs to process user given website
> addresses .My problem is that ,I need to treat
>  http://mysite.com ,
> www.mysite.com,
> mysite.com,
> www.mysite.com/index.html,
> www.mysite.com/index.php ...etc as the same and not different urls.How
> can I do the validation in this case?Do I have to manually do the
> string parsing and validate?
> Any suggestions most welcome
> thanks
> harry
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: Rich email with attachments

2010-10-14 Thread Alec Shaner
On Thu, Oct 14, 2010 at 3:45 AM, Sheena  wrote:
> I also want to have the option to add any attachment. So I want to
> have a button that when pressed allows the user to pick a file on
> their hdd and have it uploaded immediately, without loosing anything
> that's already filled in on the email form.

I have implemented this in my project using django-tinymce, swfupload
and jquery. It was definitely one of the hardest features to
implement. If you want to go this route I can tell you one issue I ran
into was flash and cookies. This caused problems with authentication
(my upload service requires auth) and CSRF, but there was a simple fix
I found by googling to add some middleware. Here is one link with some
guidelines:

http://stackoverflow.com/questions/612734/code-samples-for-django-swfupload

I'm not 100% sold on swfupload and I did some research on other flash
based options, but I got so invested in swfupload I didn't have time
to try others.

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



Re: Help with Manager.

2010-10-14 Thread Alec Shaner
See this:

http://ifacethoughts.net/2009/07/14/calculated-fields-in-django/

So perhaps the 'extra' query filter is what you need.

2010/10/14 Marc Aymerich :
>
>
> 2010/10/14 Marc Aymerich 
>>
>>
>> 2010/10/14 Jonathan Barratt 
>>>
>>> On 14 ต.ค. 2010, at 22:27, Marc Aymerich wrote:
>>>
>>> Hi,
>>> I'm trying to make a Manager for my model "order". I want that it returns
>>> all orders that their 'active period'* is greater than a certain threshold.
>>> With "active period" I mean: (order.cancel_date - order.register_date )
>>> My Order model looks like this:
>>> class order(models.Model):
>>>     register_date = models.DateTimeField(auto_now_add=True)
>>>     cancel_date = models.DateTimeField(null=True, blank=True)
>>>
>>> I'm wondering if is possible to achieve that using "annotate", something
>>> like that:
>>> (this not work)
>>>
>>> order.objects.annotate(diff=SUB('cancel_date','register_date')).filter(diff__gt=period_threshold)
>>>
>>> or maybe django provides another kind of tool to achieve what i want ?
>>>
>>> Unless I'm misunderstanding what you're looking for, I think this might
>>> suit your needs:
>>> in your model:
>>>
>>> class order(models.Model):
>>>
>>> ...
>>>     def get_active_period(self): return self.cancel_date -
>>> self.register_date active_period = property(get_active_period)
>>> (you may want to add some checking that cancel_date is not null, or that
>>> active_period is not negative but you get the idea)
>>> Then where you need to access that queryset use:
>>> order.objects.filter(active_period__gt=period_threshold)
>>
>> jops ;(, unfortunately the Manager doesn't know what "active_period" is.
>> This is my order model now:
>> class order(models.Model):
>>     [...]
>>     def get_active_period(self):
>>         if self.cancel_date:
>>             return self.cancel_date-self.register_date
>>         else:
>>             return datetime.datetime.now()-self.register_date
>>
>>     active_period = property(get_active_period)
>>     objects = models.Manager()
>>     pending_of_bill = pending_of_billManager()
>>
>> And this is my manager:
>> class pending_of_billManager(models.Manager):
>>     def get_query_set(self):
>>         [...]
>>         return super(pending_of_billManager,
>> self).get_query_set().filter(active_period__gt=threshold)
>> This Works:
>> >>> order.objects.get(pk=1).active_period
>> datetime.timedelta(0, 8347, 24949)
>> but this doesn't:
>> >>> order.pending_of_bill.all()
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "/usr/lib/python2.6/dist-packages/django/db/models/manager.py",
>> line 117, in all
>>     return self.get_query_set()
>>   File "/home/ucp/trunk/ucp/../ucp/order/models.py", line 15, in
>> get_query_set
>>     return super(pending_of_billManager,
>> self).get_query_set().filter(active_period__gt=threshold)
>>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
>> 549, in filter
>>     return self._filter_or_exclude(False, *args, **kwargs)
>>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
>> 567, in _filter_or_exclude
>>     clone.query.add_q(Q(*args, **kwargs))
>>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/query.py",
>> line 1128, in add_q
>>     can_reuse=used_aliases)
>>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/query.py",
>> line 1026, in add_filter
>>     negate=negate, process_extras=process_extras)
>>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/query.py",
>> line 1191, in setup_joins
>>     "Choices are: %s" % (name, ", ".join(names)))
>> FieldError: Cannot resolve keyword 'active_period' into field. Choices
>> are: amendment_invoice, amendment_quota, bill, cancel_date, comment,
>> contracted_pack, discount, entity, forward, htacces, htpasswd, id, included,
>> installed_app, mailman, name, order_disk, order_memory, order_swap, ovz,
>> pack, price, register_date, renew, service, size, system_group, system_user,
>> system_user_related, traffic, virtual_aliase, virtual_user,
>> virtual_user_related, virtualhost
>>
>> What I'm missing ?? why super(pending_of_billManager,
>> self).get_query_set() doesn't know about active_period?
>> Thanks!
>
> Seems that we can't use a property as a queryset 'filter', in other words we
> can't use property like this:
>  order.objects.filter(active_time__gt=whatever)
>
>
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@g

Re: Help with Manager.

2010-10-14 Thread Alec Shaner
You can't add a datetime to another datetime - you want to add a
datetime.timedelta instance instead. Out of curiosity I just tested it
on one of my models and it does work, e.g.,

MyModel.objects.filter(update_date__gt=F('entry_date')+timedelta(days=5))

On Thu, Oct 14, 2010 at 5:57 PM, Marc Aymerich  wrote:
>
>
> On Thu, Oct 14, 2010 at 10:08 PM, Alec Shaner  wrote:
>>
>> See this:
>>
>> http://ifacethoughts.net/2009/07/14/calculated-fields-in-django/
>>
>> So perhaps the 'extra' query filter is what you need.
>>
>
> Yep, I got a success using extra filter :) Thanks Alec for sharing this!
> by the way, just right now I found the way to reference field on filter and
> operates with it. It can be achieved using instances of F()
>  http://docs.djangoproject.com/en/dev/topics/db/queries/#filters-can-reference-fields-on-the-model
> it could be more 'elegant' than using an extra filter, all I need is
> something like that:
> order.objects.filter(Q(cancel_date__isnull=False,
> cancel_date__lt=F('register_date') + Threshold)
> | Q(cancel_date__isnull=True, register_date__gt=Threshold) )
> but i couldn't get working this part: "F('register_date')+Threshold"
> ,(threshold is a datetime.datetime object, and also 'register_date' field.
> Anyone knows the correct way to use instances of F() with date field?
>
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help with Manager.

2010-10-15 Thread Alec Shaner
Sorry, not sure about that warning because I'm using a postgresql database.

On Fri, Oct 15, 2010 at 3:17 AM, Marc Aymerich  wrote:
>
>
> On Fri, Oct 15, 2010 at 3:39 AM, Alec Shaner  wrote:
>>
>> You can't add a datetime to another datetime - you want to add a
>> datetime.timedelta instance instead. Out of curiosity I just tested it
>> on one of my models and it does work, e.g.,
>>
>> MyModel.objects.filter(update_date__gt=F('entry_date')+timedelta(days=5))
>
>
> Hi Alec, thanks again for your answer :)
> When you executes this filter on a shell you don't get a warning ?
> This is what happens to me:
>>>>
>>>> order.objects.filter(cancel_date__isnull=False).filter(cancel_date__lt=F('register_date')
>>>> + timedelta(days=3))
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
> 67, in __repr__
>     data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
> 82, in __len__
>     self._result_cache.extend(list(self._iter))
>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
> 268, in iterator
>     for row in compiler.results_iter():
>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
> line 672, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
> line 727, in execute_sql
>     cursor.execute(sql, params)
>   File "/usr/lib/python2.6/dist-packages/django/db/backends/util.py", line
> 18, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/lib/python2.6/dist-packages/django/db/backends/mysql/base.py",
> line 86, in execute
>     return self.cursor.execute(query, args)
>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 168, in
> execute
>     if not self._defer_warnings: self._warning_check()
>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 82, in
> _warning_check
>     warn(w[-1], self.Warning, 3)
> Warning: Truncated incorrect DOUBLE value: '3 0:0:0'
> It's only a warning, but I can't see the output queryset result, maybe it's
> a ""fatal"" warning? you know why this is happening?
> Thanks again!!
>
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
It should be clarified that this occurs on the mysql backend, but not
the postgres backend. It has to do with how MySQL handles the DATETIME
object. You can't add a timedelta, because it expects a double.

I created a test app using a mysql backend and a Article model with
created and updated datetime fields.

created = 2010-10-15 09:13:02
updated = 2010-10-15 09:18:43

select created - updated from article_article
+---+
| updated - created |
+---+
|541.00 |
+---+

It's using the MMDDHHMMSS format of the datetime fields:

20101015091843 - 20101015091302 = 541

The delta isn't constant either, here are two sets of times that are 5
minutes apart:

created=2010-10-15 09:00:00, updated=2010-10-15 09:05:00
mysql: select created - updated yiels 500

created=2010-10-15:09:59:00, updated=2010-10-15 10:04:00
mysql: select created - updated yields 4500

I haven't looked at the django mysql backend code, but based on this
that warning is fatal in your case because it's definitely not doing
what you want. And I don't see how you could write your query filter
in its current format so that it is postgres/mysql agnostic


On Fri, Oct 15, 2010 at 7:01 AM, Marc Aymerich  wrote:
> This is a fork of this tread:
> http://groups.google.com/group/django-users/browse_thread/thread/5c6beb41fcf961a4
> I'm getting troubles combining instances of F() and timedelta. I'm working
> with the very last trunk revision (14232),
> I create a very simple model for troubleshoting the problem, the model is:
> class dates(models.Model):
>     date1 = models.DateField(auto_now_add=True)
>     date2 = models.DateField()
> And this is what I'm try to do:
>>>> from test.dates.dates import dates
>>>> from django.db.models import F
>>>> import datetime
>>>>
>>>> dates.objects.filter(date1__gte=F('date2')+datetime.timedelta(minutes=3))
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
> 67, in __repr__
>     data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
> 82, in __len__
>     self._result_cache.extend(list(self._iter))
>   File "/usr/lib/python2.6/dist-packages/django/db/models/query.py", line
> 268, in iterator
>     for row in compiler.results_iter():
>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
> line 675, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File "/usr/lib/python2.6/dist-packages/django/db/models/sql/compiler.py",
> line 730, in execute_sql
>     cursor.execute(sql, params)
>   File "/usr/lib/python2.6/dist-packages/django/db/backends/util.py", line
> 18, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/lib/python2.6/dist-packages/django/db/backends/mysql/base.py",
> line 86, in execute
>     return self.cursor.execute(query, args)
>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 168, in
> execute
>     if not self._defer_warnings: self._warning_check()
>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 82, in
> _warning_check
>     warn(w[-1], self.Warning, 3)
> Warning: Truncated incorrect DOUBLE value: '0 0:3:0'
>
> On the parent
> thread http://groups.google.com/group/django-users/browse_thread/thread/5c6beb41fcf961a4 Alec
> reports that this works on their django installation.
> More over this pice of django code make use of
> it: http://code.djangoproject.com/attachment/ticket/10154/dateexpressions.diff
> Is this really a bug? it should be reported to django "bug tracker"?
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
On Fri, Oct 15, 2010 at 1:26 PM, Marc Aymerich  wrote:
>
> Instead of use datatime.timedelta I convert it to string with this format:
>  MMDDHHMMSS and now all works fine with mysql :) Unfortunately this part
> of code doesn't be database independent :(
>
> Thank you very much alec!
>
> --
> Marc

No problem.

So if you don't mind, what does your query filter look like now using
the converted format?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
Interesting solution - after all that maybe it's more concise to just
use the 'extra' filter instead since you're making it specific to
mysql anyway, and you could use mysql date functions.

By the way, in answer to your original question on this thread, there
already is a ticket to add F() + timedelta.

http://code.djangoproject.com/ticket/10154

On Fri, Oct 15, 2010 at 2:48 PM, Marc Aymerich  wrote:
>
>
> On Fri, Oct 15, 2010 at 7:54 PM, Alec Shaner  wrote:
>>
>> On Fri, Oct 15, 2010 at 1:26 PM, Marc Aymerich 
>> wrote:
>> >
>> > Instead of use datatime.timedelta I convert it to string with this
>> > format:
>> >  MMDDHHMMSS and now all works fine with mysql :) Unfortunately this
>> > part
>> > of code doesn't be database independent :(
>> >
>> > Thank you very much alec!
>> >
>> > --
>> > Marc
>>
>> No problem.
>>
>> So if you don't mind, what does your query filter look like now using
>> the converted format?
>>
>
> hi :)
> this is the get_query_set method of my custom Manager:
> def get_query_set(self):
>     c=config.get('ignore_bill_period')
>     #c is a dict like this {u'hours': u'00', u'seconds': u'00', u'minutes':
> u'00', u'days': u'07'}
>     ignore_period = c['days']+c['hours']+c['minutes']+c['seconds']
>     delta_ignore_period = datetime.timedelta(days=int(c['days']),
>         hours=int(c['hours']), minutes=int(c['minutes']),
> seconds=int(c['seconds']))
>     now_sub_ignore = datetime.datetime.now() - delta_ignore_period
>     #IF db backend is MySQL:
>     return super(pending_of_billManager,
> self).get_query_set().filter(Q(cancel_date__isnull=False, \
>         cancel_date__gt=F('register_date') + ignore_period) |
> Q(cancel_date__isnull=True, \
>         register_date__lt=now_sub_ignore))
>     #ELSE:
>     #return super(pending_of_billManager,
> self).get_query_set().filter(Q(cancel_date__isnull=False, \
>     #    cancel_date__gt=F('register_date') + delta_ignore_period) |
> Q(cancel_date__isnull=True,
>     #    register_date__lt=now_sub_ignore))
> a lot of code for a simple query, but it's the best I can do :)
> br
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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: F() and timedelta. Bug on django?

2010-10-15 Thread Alec Shaner
doh! Just noticed that you already referenced ticket 10154 in your
original post.

On Fri, Oct 15, 2010 at 3:16 PM, Alec Shaner  wrote:
> Interesting solution - after all that maybe it's more concise to just
> use the 'extra' filter instead since you're making it specific to
> mysql anyway, and you could use mysql date functions.
>
> By the way, in answer to your original question on this thread, there
> already is a ticket to add F() + timedelta.
>
> http://code.djangoproject.com/ticket/10154
>
> On Fri, Oct 15, 2010 at 2:48 PM, Marc Aymerich  wrote:
>>
>>
>> On Fri, Oct 15, 2010 at 7:54 PM, Alec Shaner  wrote:
>>>
>>> On Fri, Oct 15, 2010 at 1:26 PM, Marc Aymerich 
>>> wrote:
>>> >
>>> > Instead of use datatime.timedelta I convert it to string with this
>>> > format:
>>> >  MMDDHHMMSS and now all works fine with mysql :) Unfortunately this
>>> > part
>>> > of code doesn't be database independent :(
>>> >
>>> > Thank you very much alec!
>>> >
>>> > --
>>> > Marc
>>>
>>> No problem.
>>>
>>> So if you don't mind, what does your query filter look like now using
>>> the converted format?
>>>
>>
>> hi :)
>> this is the get_query_set method of my custom Manager:
>> def get_query_set(self):
>>     c=config.get('ignore_bill_period')
>>     #c is a dict like this {u'hours': u'00', u'seconds': u'00', u'minutes':
>> u'00', u'days': u'07'}
>>     ignore_period = c['days']+c['hours']+c['minutes']+c['seconds']
>>     delta_ignore_period = datetime.timedelta(days=int(c['days']),
>>         hours=int(c['hours']), minutes=int(c['minutes']),
>> seconds=int(c['seconds']))
>>     now_sub_ignore = datetime.datetime.now() - delta_ignore_period
>>     #IF db backend is MySQL:
>>     return super(pending_of_billManager,
>> self).get_query_set().filter(Q(cancel_date__isnull=False, \
>>         cancel_date__gt=F('register_date') + ignore_period) |
>> Q(cancel_date__isnull=True, \
>>         register_date__lt=now_sub_ignore))
>>     #ELSE:
>>     #return super(pending_of_billManager,
>> self).get_query_set().filter(Q(cancel_date__isnull=False, \
>>     #    cancel_date__gt=F('register_date') + delta_ignore_period) |
>> Q(cancel_date__isnull=True,
>>     #    register_date__lt=now_sub_ignore))
>> a lot of code for a simple query, but it's the best I can do :)
>> br
>> --
>> Marc
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help with django url errors

2010-10-17 Thread Alec Shaner
I think nother problem is your polls/urls.py is wrong. The /polls
prefix of the url will be removed by the main urls.py file before
being matched against the included polls/urls.py

http://docs.djangoproject.com/en/1.2/topics/http/urls/#including-other-urlconfs


On Sun, Oct 17, 2010 at 4:52 AM, Daniel Roseman  wrote:
> On Oct 17, 8:36 am, codingJoe  wrote:
>> All,
>>
>> I am working through the django tutorial on the bitnami stack and am
>> having difficulty getting my urls to work properly.  The following
>> references the tutorial part 3 - Poll details.    I suspect the
>> problem may be that the bitnami stack uses apache.  But I have no idea
>> how to configure apache and django to run the tutorial properly.
>>
>> 1.  I enter the following into my browser:  http://192.168.1.6:8080/polls/
>>
>>    Response is a 404 error:
>>
>>    Using the URLconf defined in mysite.urls, Django tried these URL
>> patterns, in this order:
>>       1. ^polls/
>>       2. ^admin/doc/
>>       3. ^admin/
>>    The current URL, , didn't match any of these.
>>
>> Question:  Clearly 'polls' is in both the url and the files below.
>> How do I configure this?
>>
>> begin mysite/urls.py 
>> # Uncomment the next two lines to enable the admin:
>>     4 from django.contrib import admin
>>     5 admin.autodiscover()
>>     6
>>     7 urlpatterns = patterns('',
>>     8       # Example:
>>     9       # (r'^mysite/', include('mysite.foo.urls')),
>>    10       (r'^polls/', include('polls.urls')),
>>    11       (r'^admin/doc/',
>> include('django.contrib.admindocs.urls')),
>>    12       (r'^admin/', include(admin.site.urls)),
>>    13     )
>>
>> end mysite/urls.py 
>>
>> begin mysite/polls/urls.py 
>>  1 from django.conf.urls.defaults import *
>>     2 from django.contrib import admin
>>     3
>>     4 admin.autodiscover()
>>     5
>>     6 urlpatterns = patterns('',
>>     7       (r'^polls/$', 'polls.views.index'),
>>     8       (r'^polls/(?P\d+)/$', 'detail'),
>>     9       (r'^polls/(?P\d+)/results/$', 'results'),
>>    10       (r'^polls/(?P\d+)/vote/$', 'vote'),
>>    11       (r'^admin/doc/',
>> include('django.contrib.admindocs.urls')),
>>    12       (r'^admin/', include(admin.site.urls)),
>>    13     )
>>
>> begin django.conf 
>> # Note:  Tried adding polls to line 3 but that didn't help.
>> 1
>>     2 WSGIScriptAlias /mysite "/Applications/djangostack-1.2.3-0/apps/
>> django/conf/django.wsgi"
>>     3 WSGIScriptAlias /polls "/Applications/djangostack-1.2.3-0/apps/
>> django/conf/django.wsgi"
>>     4
>>     5 
>>     6 Order deny,allow
>>     7 Allow from all
>>     8 
>>
>> end django.conf 
>>
>> begin django.wsgi 
>>  import os, sys
>>     2 sys.path.append('/Applications/djangostack-1.2.3-0/projects')
>>     3 sys.path.append('/Applications/djangostack-1.2.3-0/projects/
>> mysite')
>>     4 os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>>     5
>>     6 import django.core.handlers.wsgi
>>     7
>>     8 application = django.core.handlers.wsgi.WSGIHandler()
>>
>> end django.wsgi 
>
> You're trying to run before you can walk here. The Django tutorial
> teaches you how to set up urls and views using the built-in
> development server. It's only once you understand those fully that you
> should try and configure it with Apache.
>
> However, the problem you're having is in your Apache configuration
> file. For some reason, you're trying to set up ScriptAliases for each
> URL. Don't do that. Just set up a single one for the root of your
> site:
>
>    WSGIScriptAlias / "/Applications/djangostack-1.2.3-0/apps/django/
> conf/django.wsgi"
>
> That will then pick up all requests and pass them through to Django,
> where they will be routed by urls.py.
> --
> 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-us...@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-us...@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: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Alec Shaner
On Tue, Oct 26, 2010 at 12:40 PM, Phlip  wrote:
>
> So this statement correctly fetches only the latest items:
>
> SELECT a.* FROM things a WHERE a.pid in (select max(b.pid) from
> content_entity b group by b.name)
>
> Now I thought (from my allegedly copious experience with SQL) that I
> could do it with a join-on-self, but I can't seem to get the SQL
> syntax right. And if I did, I would then not know how to ORM-ize that
> syntax (and yes it must be ORM-ized, because this is indeed the core
> of the project, and everything has to see top-level horizons. Except
> auditors).
>

Regarding this query, I think you may be able to do this using
annotate. See http://docs.djangoproject.com/en/dev/topics/db/aggregation/#values

For example (and this probably sucks for performance):

Things.objects.filter(id__in=Things.objects.values('name').annotate(max_id=Max('id')).values_list('max_id',
flat=True))

This is just a self join example, but it could probably be rewritten
to use the two tables in your example.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Complex ManyToMany-Intersection-With-Set Query?

2010-03-01 Thread Alec Muffett
Hi Everybody!

I floated this at #DJUGL last week, but I thought I would just open the 
question up to greater scrutiny; I have an iterative, slow solution which 
works, but I would love to solve the problem more efficiently.  

Rather than bury you under details, here's some pseudocode which illustrates 
the challenge; we have three models:

class Ingredient(models.Model):
"""ingredient in a meal"""
name = models.CharField()
supplier = models.CharField()
price_per_kg = models.PositiveIntegerField()
calories_per_kg = models.PositiveIntegerField()
yadda = models.YaddaField()

class Recipe(models.Model):
"""cooking recipes"""
name = models.CharField()
ingredients = models.ManyToManyField(Ingredient)
minutes_to_prepare = models.PositiveIntegerField()
cooking_procedure = models.CharField()

class Child(models.Model):
"""those picky people who will be eating"""
name = models.CharField()
wants_ingredients = models.ManyToManyField(Ingredient)
hates_ingredients = models.ManyToManyField(Ingredient)


# CHALLENGE:

# for a given Child instance: 
# alice = Child.objects.get(name="Alice")
#
# SELECT ALL Recipes WHERE:
# AT LEAST ONE OF recipe.ingredients IS AMONGST alice.wants_ingredients
# AND NONE OF recipe.ingredients ARE AMONGST alice.hates_ingredients

...without resorting to non-portable SQL, or ideally without custom SQL at all.


The *actual* problem is even more complex that this, but what really vexes me 
is how to efficiently do a "ManyToManyField-intersects-some-predetermined-set" 
search.

I believe I am thinking about the problem too hard and in the wrong way / need 
to be querying the M2M relationship tables, but I can't step back far enough to 
see the right answer.

Can anyone help me out of this rut, please?

Thanks in advance!

- alec

--
alec.muff...@gmail.com
http://www.crypticide.com/dropsafe/




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Including URLconf

2022-03-07 Thread Alec Greenholdt

this is what i did and it changed nothing. i also don't know what exactly 
you mean by app because I don't believe I ever created an app. as shown 
above the code  2 lines of code with polls is the only thing I've added as 
shown in the tutorial
On Monday, March 7, 2022 at 8:47:46 PM UTC-6 guitard...@gmail.com wrote:

> That's definitely your problem. Include the app under INSTALLED_APPS - put 
> "app_name.apps.AppNameConfig" with app_name being the name of your app.
>
> On Monday, March 7, 2022 at 11:35:40 AM UTC-6 alec...@gmail.com wrote:
>
>> this is the installed apps in settings.py I haven't touched it. i only 
>> did what it told me to do in the django tutorial documentation. as a 
>> reminder, I attached only things I have added since I created the project. 
>> i even tried to delete it all and redo it and I get the same issue
>>
>> On Monday, March 7, 2022 at 8:42:58 AM UTC-6 guitard...@gmail.com wrote:
>>
>>> Do you have the app imported in the settings.py?
>>>
>>> Also try using the "app_name" var in each of your urls.py files.
>>>
>>> On Sunday, March 6, 2022 at 10:29:23 PM UTC-6 alec...@gmail.com wrote:
>>>
>>>>
>>>> if i try to migrate, this error pops up as well
>>>> On Sunday, March 6, 2022 at 6:24:44 PM UTC-6 Alec Greenholdt wrote:
>>>>
>>>>> as described in the documentation i am putting this code in. as soon 
>>>>> as i put in "path('polls/', include('polls.urls'))," i get the 
>>>>> following error. Please help
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a7ff4e06-692f-43c3-86ea-1b0717faaf3cn%40googlegroups.com.


Re: Including URLconf

2022-03-08 Thread Alec Greenholdt
these are my folders. the only thing the tutorial had me create upon 
creation of the project and app was a urls.py file inside my "mainsite" 
folder. and I show in the code above what it had me add. those are the only 
things I have done

On Tuesday, March 8, 2022 at 7:12:23 AM UTC-6 jmizpaha...@gmail.com wrote:

> Question: Do you have a folder named polls in your project directory? And 
> inside that directory there's an apps.py file? 
>
> On Tuesday, 8 March 2022 at 11:47:56 UTC+8 alec...@gmail.com wrote:
>
>>
>> this is what i did and it changed nothing. i also don't know what exactly 
>> you mean by app because I don't believe I ever created an app. as shown 
>> above the code  2 lines of code with polls is the only thing I've added as 
>> shown in the tutorial
>> On Monday, March 7, 2022 at 8:47:46 PM UTC-6 guitard...@gmail.com wrote:
>>
>>> That's definitely your problem. Include the app under INSTALLED_APPS - 
>>> put "app_name.apps.AppNameConfig" with app_name being the name of your app.
>>>
>>> On Monday, March 7, 2022 at 11:35:40 AM UTC-6 alec...@gmail.com wrote:
>>>
>>>> this is the installed apps in settings.py I haven't touched it. i only 
>>>> did what it told me to do in the django tutorial documentation. as a 
>>>> reminder, I attached only things I have added since I created the project. 
>>>> i even tried to delete it all and redo it and I get the same issue
>>>>
>>>> On Monday, March 7, 2022 at 8:42:58 AM UTC-6 guitard...@gmail.com 
>>>> wrote:
>>>>
>>>>> Do you have the app imported in the settings.py?
>>>>>
>>>>> Also try using the "app_name" var in each of your urls.py files.
>>>>>
>>>>> On Sunday, March 6, 2022 at 10:29:23 PM UTC-6 alec...@gmail.com wrote:
>>>>>
>>>>>>
>>>>>> if i try to migrate, this error pops up as well
>>>>>> On Sunday, March 6, 2022 at 6:24:44 PM UTC-6 Alec Greenholdt wrote:
>>>>>>
>>>>>>> as described in the documentation i am putting this code in. as soon 
>>>>>>> as i put in "path('polls/', include('polls.urls'))," i get the 
>>>>>>> following error. Please help
>>>>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b3a71469-967e-4c63-a0be-22e963cbc7bbn%40googlegroups.com.


Template inheritance not working

2022-10-31 Thread Alec Delaney
I have been trying to get my templates to work but they have been
ineffective. here is my code:
{% extends "index.html" %}






Document



{% block content %}


{% endblock %}




//index.html:






Document


{% block content %}
Hello, this is a test.
Help me.
{% endblock %}



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com.


Re: Template inheritance not working

2022-11-08 Thread Alec Delaney
Thank you!

On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed 
wrote:

> Hello dear
> There is a little mistake in your code :
> You should put the {%block block_name %} in your base template with no
> code and the put the code you want to be displayed in your child template
> file
> Here is an example :
>
> // file.html :
>
> {% extends "index.html" %}
>
> {% block content %}
> Hello, this is a test.
> Help me.
> {% endblock %}
>
> //index.html:
> 
> 
> 
> 
> 
> Document
> 
> 
> {% block content %}
>
> {% endblock %}
> 
> 
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
> wrote:
>
>> I have been trying to get my templates to work but they have been
>> ineffective. here is my code:
>> {% extends "index.html" %}
>>
>> 
>> 
>> 
>> 
>> > >
>> Document
>> 
>> 
>> 
>> {% block content %}
>>
>>
>> {% endblock %}
>> 
>> 
>> 
>>
>> //index.html:
>>
>> 
>> 
>> 
>> 
>> > >
>> Document
>> 
>> 
>> {% block content %}
>> Hello, this is a test.
>> Help me.
>> {% endblock %}
>> 
>> 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGjzRUmsi3Ugh_Xmcrnu%2BBkAVWKcuHpt3-C4Qvn6u1QRrA%40mail.gmail.com.


Re: Template inheritance not working

2022-11-18 Thread Alec Delaney
Hello. How are you? Can I see another example of template inheritance?

On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed 
wrote:

> Hello dear
> There is a little mistake in your code :
> You should put the {%block block_name %} in your base template with no
> code and the put the code you want to be displayed in your child template
> file
> Here is an example :
>
> // file.html :
>
> {% extends "index.html" %}
>
> {% block content %}
> Hello, this is a test.
> Help me.
> {% endblock %}
>
> //index.html:
> 
> 
> 
> 
> 
> Document
> 
> 
> {% block content %}
>
> {% endblock %}
> 
> 
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
> wrote:
>
>> I have been trying to get my templates to work but they have been
>> ineffective. here is my code:
>> {% extends "index.html" %}
>>
>> 
>> 
>> 
>> 
>> > >
>> Document
>> 
>> 
>> 
>> {% block content %}
>>
>>
>> {% endblock %}
>> 
>> 
>> 
>>
>> //index.html:
>>
>> 
>> 
>> 
>> 
>> > >
>> Document
>> 
>> 
>> {% block content %}
>> Hello, this is a test.
>> Help me.
>> {% endblock %}
>> 
>> 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGitQmZVFG_v1kKOk5s5r53NYCYKEGFZ1Pdi%2Bm%2BiMAFRig%40mail.gmail.com.


Re: Template inheritance not working

2022-11-19 Thread Alec Delaney
Hello, would you be available for zoom?


On Fri, Nov 18, 2022 at 10:04 PM Chukwudi Onwusa 
wrote:

> What error is it showing you?
> Please send a picture of it. Remember you can save your base with your
> desired name, but you should also not that you should register your
> templates directory in settings template list as [BASE_DIRS/ "templates"]
> and Incase your template files are in an embedded directory inside your
> templates directory, kindly do well to correct it as
> "embeddedDirectory/baseName.html" and also correct your views for other
> templates references too if need be.
> Thanks.
> Best Regards.
>
> On Fri, Nov 18, 2022, 22:01 David Emanuel Sandoval <
> davidemanuelsando...@gmail.com> wrote:
>
>> The base template contains the default content, and blocks with default
>> contents in it. Then, in the child template, you can override those blocks.
>>
>> El vie, 18 nov 2022 17:54, Alec Delaney <96alecpatr...@gmail.com>
>> escribió:
>>
>>> Hello. How are you? Can I see another example of template inheritance?
>>>
>>> On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed 
>>> wrote:
>>>
>>>> Hello dear
>>>> There is a little mistake in your code :
>>>> You should put the {%block block_name %} in your base template with no
>>>> code and the put the code you want to be displayed in your child template
>>>> file
>>>> Here is an example :
>>>>
>>>> // file.html :
>>>>
>>>> {% extends "index.html" %}
>>>>
>>>> {% block content %}
>>>> Hello, this is a test.
>>>> Help me.
>>>> {% endblock %}
>>>>
>>>> //index.html:
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Document
>>>> 
>>>> 
>>>> {% block content %}
>>>>
>>>> {% endblock %}
>>>> 
>>>> 
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>>
>>>> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
>>>> wrote:
>>>>
>>>>> I have been trying to get my templates to work but they have been
>>>>> ineffective. here is my code:
>>>>> {% extends "index.html" %}
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Document
>>>>> 
>>>>> 
>>>>> 
>>>>> {% block content %}
>>>>>
>>>>>
>>>>> {% endblock %}
>>>>> 
>>>>> 
>>>>> 
>>>>>
>>>>> //index.html:
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Document
>>>>> 
>>>>> 
>>>>> {% block content %}
>>>>> Hello, this is a test.
>>>>> Help me.
>>>>> {% endblock %}
>>>>> 
>>>>> 
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_sour

Re: Template inheritance not working

2022-11-19 Thread Alec Delaney
Okay, Cause I am looking for another example for template inheritance


On Sat, Nov 19, 2022 at 11:54 AM Chukwudi Onwusa 
wrote:

> On WhatsApp
>
> On Sat, Nov 19, 2022, 17:14 Alec Delaney <96alecpatr...@gmail.com> wrote:
>
>> Hello, would you be available for zoom?
>>
>>
>> On Fri, Nov 18, 2022 at 10:04 PM Chukwudi Onwusa 
>> wrote:
>>
>>> What error is it showing you?
>>> Please send a picture of it. Remember you can save your base with your
>>> desired name, but you should also not that you should register your
>>> templates directory in settings template list as [BASE_DIRS/ "templates"]
>>> and Incase your template files are in an embedded directory inside your
>>> templates directory, kindly do well to correct it as
>>> "embeddedDirectory/baseName.html" and also correct your views for other
>>> templates references too if need be.
>>> Thanks.
>>> Best Regards.
>>>
>>> On Fri, Nov 18, 2022, 22:01 David Emanuel Sandoval <
>>> davidemanuelsando...@gmail.com> wrote:
>>>
>>>> The base template contains the default content, and blocks with default
>>>> contents in it. Then, in the child template, you can override those blocks.
>>>>
>>>> El vie, 18 nov 2022 17:54, Alec Delaney <96alecpatr...@gmail.com>
>>>> escribió:
>>>>
>>>>> Hello. How are you? Can I see another example of template inheritance?
>>>>>
>>>>> On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed 
>>>>> wrote:
>>>>>
>>>>>> Hello dear
>>>>>> There is a little mistake in your code :
>>>>>> You should put the {%block block_name %} in your base template with
>>>>>> no code and the put the code you want to be displayed in your child
>>>>>> template file
>>>>>> Here is an example :
>>>>>>
>>>>>> // file.html :
>>>>>>
>>>>>> {% extends "index.html" %}
>>>>>>
>>>>>> {% block content %}
>>>>>> Hello, this is a test.
>>>>>> Help me.
>>>>>> {% endblock %}
>>>>>>
>>>>>> //index.html:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>     Document
>>>>>> 
>>>>>> 
>>>>>> {% block content %}
>>>>>>
>>>>>> {% endblock %}
>>>>>> 
>>>>>> 
>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Django users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to django-users+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>>
>>>>>> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I have been trying to get my templates to work but they have been
>>>>>>> ineffective. here is my code:
>>>>>>> {% extends "index.html" %}
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Document
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> {% block content %}
>>>>>>>
>>>>>>>
>>>>>>> {% endblock %}
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>> //index.html:
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>

Re: Template inheritance not working

2022-11-19 Thread Alec Delaney
you dont have zoom?


On Sat, Nov 19, 2022 at 12:09 PM Alec Delaney <96alecpatr...@gmail.com>
wrote:

> Okay, Cause I am looking for another example for template inheritance
>
>
> On Sat, Nov 19, 2022 at 11:54 AM Chukwudi Onwusa 
> wrote:
>
>> On WhatsApp
>>
>> On Sat, Nov 19, 2022, 17:14 Alec Delaney <96alecpatr...@gmail.com> wrote:
>>
>>> Hello, would you be available for zoom?
>>>
>>>
>>> On Fri, Nov 18, 2022 at 10:04 PM Chukwudi Onwusa 
>>> wrote:
>>>
>>>> What error is it showing you?
>>>> Please send a picture of it. Remember you can save your base with your
>>>> desired name, but you should also not that you should register your
>>>> templates directory in settings template list as [BASE_DIRS/ "templates"]
>>>> and Incase your template files are in an embedded directory inside your
>>>> templates directory, kindly do well to correct it as
>>>> "embeddedDirectory/baseName.html" and also correct your views for other
>>>> templates references too if need be.
>>>> Thanks.
>>>> Best Regards.
>>>>
>>>> On Fri, Nov 18, 2022, 22:01 David Emanuel Sandoval <
>>>> davidemanuelsando...@gmail.com> wrote:
>>>>
>>>>> The base template contains the default content, and blocks with
>>>>> default contents in it. Then, in the child template, you can override 
>>>>> those
>>>>> blocks.
>>>>>
>>>>> El vie, 18 nov 2022 17:54, Alec Delaney <96alecpatr...@gmail.com>
>>>>> escribió:
>>>>>
>>>>>> Hello. How are you? Can I see another example of template inheritance?
>>>>>>
>>>>>> On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed 
>>>>>> wrote:
>>>>>>
>>>>>>> Hello dear
>>>>>>> There is a little mistake in your code :
>>>>>>> You should put the {%block block_name %} in your base template with
>>>>>>> no code and the put the code you want to be displayed in your child
>>>>>>> template file
>>>>>>> Here is an example :
>>>>>>>
>>>>>>> // file.html :
>>>>>>>
>>>>>>> {% extends "index.html" %}
>>>>>>>
>>>>>>> {% block content %}
>>>>>>> Hello, this is a test.
>>>>>>> Help me.
>>>>>>> {% endblock %}
>>>>>>>
>>>>>>> //index.html:
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Document
>>>>>>> 
>>>>>>> 
>>>>>>> {% block content %}
>>>>>>>
>>>>>>> {% endblock %}
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Django users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to django-users+unsubscr...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>>
>>>>>>> On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I have been trying to get my templates to work but they have been
>>>>>>>> ineffective. here is my code:
>>>>>>>> {% extends "index.html" %}
>>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Document
>&

Re: Is programming in Django intellectually satisfactory

2023-04-26 Thread Alec Delaney
I love it

On Wed, Apr 26, 2023, 11:08 PM Mike Dewhirst  wrote:

> On 26/04/2023 10:18 am, Julius Chesoni wrote:
>
>  Hi guys, I find programming in the abstract very interesting and full of
> intellectual benefits similar to those acquired from Mathematics. However,
> when it comes to programming languages I find the practice of programming
> very tiresome since there are very many functions in the documentations. I
> am not able to enjoy reading the documentations even though I am eager to
> know how to master the particular language. How do you guys manage to be
> masters in languages like Django since I see some great people contributing
> to every question. This amazes me.
>
>
> Django could be thought of as a language. In fact it is a "framework" - a
> jargon word which probably needs decoding but I don't have time.
>
> Django is written in Python. Python started as a teaching language for
> primary school kids but it has sufficient sophistication for masters of
> Python to build almost anything.
>
> The two main benefits of Python are:
>
>  * ease of learning for beginners and
>  *  powerful enough for complex projects to be built faster than most
> other languages.
>
> Python was chosen by Django's original authors for a web project and they
> built libraries of useful routines which they eventually open-sourced as
> Django to make website development much more satisfying for other
> developers.
>
> The intellectual satisfaction - and therefore main attraction of Django -
> comes from being able to do anything. There are plenty of guidelines and
> "best practices" but absolutely no frustrating restrictions. If you find a
> web problem you want to solve, I would be very surprised if it couldn't be
> solved with Django.
>
> Many would argue front-end problems cannot be solved with a back-end
> server architecture like Django but nowadays, with htmx, that argument is
> lost.
>
> So, to answer your question in the abstract, Django is used as the
> interface "language" between a database and the user with a web browser. It
> contains an "Object Relational Mapper" (ORM). The mathematics of relational
> database management systems (RDBMS) should pique your interest. The
> language of RDBMS is Structured Query Language (SQL) but because Django has
> its ORM you no longer need to learn SQL. The Django library of queries
> comes to the rescue.
>
> Django, HTML+htmx and CSS therefore is all you really need to build a
> completely fuctional and intellectually satisfying website.
>
> My advice to you is to find a small project you really want to do and get
> started one step at a time.
>
> Someone else said practice practice practice. That is completely correct.
> You need to start somewhere if you are really interested.
>
> With practice you can tackle ever more interesting projects.
>
> Good luck.
>
>
> Kind regards
> Julius
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANOu6a8axU1sL6GXveq7CufyTm1JWX-6aZ7FU4fJVqLq9M0GAQ%40mail.gmail.com
> 
> .
>
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Your
> email software can handle signing.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/17f6b06b-546f-069b-4487-d740b5bd7267%40dewhirst.com.au
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGhuquB47d%3DgJUPUh%2BZAk5mPBCuXUz_FLBQ89AvW0O9-iw%40mail.gmail.com.


Re: CSV file

2023-06-10 Thread Alec Delaney
For server

On Thu, Jun 8, 2023, 15:03 Percy Masekwameng 
wrote:

> Hi
>
> I have web app survey that collect data and generate a CSV file,
> I'm using railway to deploy my web app, running on 8GB RAM and each time I
> generate a file, the server goes down and display "Application failed to
> respond" the database table has over 2k records
> Is there any way to improve the performance so that I can be able to
> download large dataset from the web app?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANfc-pBoutR0kD%3DcqwRHGSQ8gac%2B_YLMyCQoFK--%3DD54TZpotA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGiUQMhWC42LnWbCTuXv5TROrDNjU%2BQLGKU2C_4aQVoLjw%40mail.gmail.com.


Re: uwsgi

2023-06-18 Thread Alec Delaney
Yes

On Mon, Jun 19, 2023, 2:26 AM Nakamatte Norah 
wrote:

> good morning my name is Norah . This is first time to use Django and
> develope a system l need help can you . Please help to accomplish this task
>
> On Sun, Jun 4, 2023, 11:14 PM Larry Martell 
> wrote:
>
>> I normally deploy my django apps using nginx and uwsgi. I recently
>> found that the uwsgi mailing list is defunct, and I read this on the
>> uwsgi github page:
>>
>> Note: The project is in maintenance mode (only bugfixes and updates
>> for new languages apis). Do not expect quick answers on github issues.
>>
>> Are folks still deploying new apps with uwsgi, or have people switched
>> to Gunicorn or something else?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACwCsY4h8Jc4_Cd7Vf2w-8ExjfUnu0W2i-GknCuxOznk6V_V3A%40mail.gmail.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMEfT%2BQD8h8LOo27vb%2BSQYh-OuT-X3LgTvgD5Ff3VT2BfnEeNw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGjg3OKNK_51Tewc5vWc%2Bzec7Gfz2L7NPSJfTzwKUtsX9g%40mail.gmail.com.


Re: Django Channels with Queue (Lobby) Manager

2023-07-11 Thread Alec Delaney
Nicee

On Tue, Jul 11, 2023, 11:56 AM Alex R  wrote:

> Hello dear Community!
>
> I need help with Django channels and Websockets (i guess) for an
> application I am building. The project is online Chess game with Django as
> a backend and vanilla JavaScript (ajax, jQuey and some bootstrap). We are
> using custom chess engine written in python.
>
> Previously we succesfully built flask application with single view to play
> chess game hand-to-hand. I wanted to improve our backend and introduce game
> lobbies - general online. This would also be a great practice and learning.
> Or so I thought.
> I have gone through the Django Channels docs and followed simple tutorial
> to create a chat application - more or less the concept is understood.
>
> My goal is to create a lobby like system as in other online games:
>
>- User has to be autorized and only authorized users can do anything
>- You can click on "New game" - it will put you in waiting or lobby
>room. If you match with another user who has right conditions (for now:
>oppotise pieces color) - you two are put in a game and game starts
>- If there are no games available after some timeout - it will through
>you out to main screen and ask to "Try later"
>
> I have some ideas and questions, but I would like to hear how this idea
> can be coded and what would be the right plan for realisation first. Maybe
> my questions and ideas are completely irrelevant.
>
> P.S.: We are using custom written chess engine in Python via OOP. It
> worked very poorly in Flask by just creating Game object from a class in
> View function. This you should not do... What would be the best practice to
> actually access it and when we should create it? I have seen examples with
> TicTacToe game and logic stored as a model, but i think it would be very
> heavy on database
>
> Looking forward for replies :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ca46cb38-d3a7-4d24-b5f2-b7fda612f445n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFGN%3DGhNrCdxmiQqLhtOPZHsMOovntxsunuriUDezhtHRbOfxQ%40mail.gmail.com.


Tutorial for dev version not working (Polls app): admin

2012-01-28 Thread Alec Taylor
Going through the tutorial using the latest trunk in a virtualenv.

I am getting stuck in this section:
https://docs.djangoproject.com/en/dev/intro/tutorial02/#s-customize-the-admin-form

No matter how I rearrange the fields (even when I remove the
"question" field), I cannot notice any difference in the poll admin
screens. I have tried syncdb, and restarting the server.

I've looked at the index screen
(http://localhost:9400/admin/polls/poll/), the view screen
(http://localhost:9400/admin/polls/poll/1/) and the add screen
(http://localhost:9400/admin/polls/poll/add/). There are no
differences in field order/display on any of these pages.

I have followed the tutorial exactly, but the fields aren't being rearranged.

Is there a different way of rearranging admin fields in Django 1.4?

Thanks for helping me get this working,

Alec Taylor

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



Displaying template location in html

2012-01-28 Thread Alec Taylor
With 40+ HTML files it's easy to get confused as to where each
component comes from.

I don't want to annotate each file with its relative path manually, as
this will prove cumbersome when the site finally goes production.

Is there a trick to displaying the template location on-screen?

Thanks for all suggestions,

Alec Taylor

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



Admin CSS not loading on dev

2012-01-29 Thread Alec Taylor
I cannot get the admin CSS to load.

The dev docs shows that:
"ADMIN_MEDIA_PREFIX
Deprecated in Django 1.4: This setting has been obsoleted by the
django.contrib.staticfiles app integration"

Checking another project I had which I generated with "startproject"
on 1.4a1 I found that its CSS works and is located here:
django\django\contrib\admin\static\admin\css

However I cannot figure out how to make the css load in my other
project. I have tried setting up a new virtualenv, but this didn't
make a difference.

Please tell me how to autoload the CSS without manually moving the .css files.

Thanks for all suggestions,

Alec Taylor

-- 
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: Displaying template location in html

2012-01-31 Thread Alec Taylor
Thanks donarb, I'll give that toolbar a try.

Mario: I though Python has all that fancy metaprogramming stuff like
Ruby with Objective C style reflection?

On Mon, Jan 30, 2012 at 12:19 PM, donarb  wrote:
> Use the Django Debug Toolbar, it shows all kinds of things. For
> templates, it shows the names of all the templates that make up the
> given page as well as which tags are used on the page.
>
> With DDT, you don't have to annotate (and un-annotate) anything.
>
> http://pypi.python.org/pypi/django-debug-toolbar
>
> On Jan 28, 10:26 pm, Alec Taylor  wrote:
>> With 40+ HTML files it's easy to get confused as to where each
>> component comes from.
>>
>> I don't want to annotate each file with its relative path manually, as
>> this will prove cumbersome when the site finally goes production.
>>
>> Is there a trick to displaying the template location on-screen?
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>
> --
> 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.



base.css 404ing on Django 1.4a1

2012-02-02 Thread Alec Taylor
Trunk version cannot load Admin CSS.

First I tried setting the ADMIN_MEDIA_PREFIX to MEDIA_PREFIX, when
that didn't work I tried manual replacing. Yes, I know it has been
depreciated and that the css are stored in
django\django\contrib\admin\static\admin\css, however it did not work
when omitted so I placed that \static\admin\ folder as a subdirectory
of my regular static directory.

ADMIN_MEDIA_PREFIX is now set to: '/static/admin/' in settings.py.

This partially worked, the top of my admin pages now look like this:



So dashboard.css is loading fine now, it's just base.css which isn't.

How should I go about getting that base.css link to not 404, or
*actually* changing that ADMIN_MEDIA_PREFIX?

Thanks for all suggestions,

Alec Taylor

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



Checklist for appreciating a project from 1.2.7 to 1.4a1

2012-02-03 Thread Alec Taylor
Good afternoon,

I'm bringing the "social-commerce" project up to the latest trunk of
Pinax and Django.

Is there a checklist of things I'll need to update?

I've begun updating it, i.e. adding the new database dictionary:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/path/to/my.cnf',
},
}
}

But it keeps giving me error after error once I've done that, so
instead of tackling issues one at a time, I thought their might be a
guide of some sort?

Thanks for all suggestions,

Alec Taylor

-- 
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 Alec Taylor
On Fri, Feb 10, 2012 at 9:58 PM, 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
>

A lot of ERP is general across any field.

I recommend working from the AGPL licensed OpenERP into Django
(http://apps.openerp.com/addon/4533): http://openerp.com

Then just build in all the hospital ERP related functions, streamline
all the interfaces (including config and admin interfaces).

If you find yourself finishing the project early, just throw in some
scope-creep :P, it's an ERP afterall!

Good luck ;)

-- 
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-14 Thread Alec Taylor
Hi Saadat,

I recommend reading a book on Django to get started.

All the best,

Alec Taylor

On Wed, Feb 15, 2012 at 1:12 AM, Saadat  wrote:
> Thanks Sebastien, I already have the info about the various
> departments of the hospital. I also created a sample database with
> tables being Patient detail, Then I created the admin interface and I
> could login and see the app over there. I could also access and edit
> the details of the tables thru the admin interface. Now, how do i
> create the view for normal user who is not an admin. What do i have to
> do with the templates? Thanks for everything.
>
> Saadat
>
> On Feb 14, 6:37 pm, sebastien piquemal  wrote:
>> +1 to @Patricio Valarezo's comment :
>>
>> If you want to build a system for hospitals, you've got to know how an
>> hospital works first. So, make interviews, draw mockups, more
>> interviews, code a prototype, more interviews, and so on ... and only
>> then you'll know what you need to do.
>>
>> On Feb 14, 4:07 am, Python_Junkie 
>> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > 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.
>

-- 
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-16 Thread Alec Taylor
ModelForm

On Thu, Feb 16, 2012 at 10:18 PM, Saadat  wrote:
> Hi all, I created a view today and I could access the database
> contents using Templates. Now I wish to create a listbox that would
> have the names of doctors. When an item from the list is selected, an
> sql query should be sent which will return all the details of that
> doctor, where doc_id is the primary key? how do we create buttons? do
> we need to use html or django can handle them also?
>
> Thanks a lot people.
> Saadat
>
> On Feb 16, 4:12 pm, Saadat  wrote:
>> Hello All
>> I created a view today and I could access the database values usi
>>
>> On Feb 14, 8:07 am, Python_Junkie 
>> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > 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.
>

-- 
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-18 Thread Alec Taylor
http://divitodesign.com/css/how-to-dropdown-css-menu/

When you're doing template stuff, read:
- HTML
- CSS
- JS
- Python

tutorials.

Also, get a book. The questions you are asking are textbook level questions.

On Sat, Feb 18, 2012 at 11:53 PM, Saadat  wrote:
> Hello all
> Can someone guide me to create a drop down menu (single-level).. i
> need to put this menu in a header file that will be included in every
> page. A bit of code and some explanation is required. tried searching
> on the Internet, but couldn't find anything. thanks a lot
>
> On Feb 17, 7:50 am, Alec Taylor  wrote:
>> ModelForm
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Feb 16, 2012 at 10:18 PM, Saadat  wrote:
>> > Hi all, I created a view today and I could access the database
>> > contents using Templates. Now I wish to create a listbox that would
>> > have the names of doctors. When an item from the list is selected, an
>> > sql query should be sent which will return all the details of that
>> > doctor, where doc_id is the primary key? how do we create buttons? do
>> > we need to use html or django can handle them also?
>>
>> > Thanks a lot people.
>> > Saadat
>>
>> > On Feb 16, 4:12 pm, Saadat  wrote:
>> >> Hello All
>> >> I created a view today and I could access the database values usi
>>
>> >> On Feb 14, 8:07 am, Python_Junkie 
>> >> wrote:
>>
>> >> > 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: dj

Re: Creating a hospital erp (hospital management) in Django

2012-02-20 Thread Alec Taylor
...

Design doesn't matter one bit for what you're doing.

Don't try and win design awards by having CSS dropdowns.

Concentrate on solving their business logic rather than adding images
of sexy nurses

And get that book. There are free books online, there's the official
django tutorial also.

On Tue, Feb 21, 2012 at 1:12 AM, Saadat  wrote:
> Hello all
> I'm stuck on static files since yesterday. It gives me an error that
> no module called "staticfiles" found.  What my requirement is that i
> have a header file where I'm including a css dropdown menu. how do i
> include that file, without using staticfiles. What all needs to be
> done to include that file. Thanks a lot.
>
> Saadat
>
> On Feb 18, 7:09 pm, Marc Aymerich  wrote:
>> On Sat, Feb 18, 2012 at 2:52 PM, Saadat  wrote:
>> > Alec, I've tried including this css file everywhere, but it doesn't show 
>> > up anywhere. What exactly do i do with it to include this script on any 
>> > page, say index. i tried doing it through html as well as django. I don't 
>> > know what I'm doing wrong?
>>
>> check this:https://docs.djangoproject.com/en/dev/howto/static-files/
>>
>> btw, this seems to me a very basic web dev related question, so maybe
>> it will be better for you to spend some time learning general web dev
>> related stuff before doing things by your own.
>>
>> --
>> Marc
>
> --
> 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 and social network

2012-02-22 Thread Alec Taylor
Pinax

http://pinaxproject.com/

On Thu, Feb 23, 2012 at 1:50 AM, Lewis  wrote:
> I am new in Django. I know it is a good platform.
> I want to know if there's any plug-ins or script that do social
> networking. I research on Pinax, but it seem very difficult to set it
> up. These are the feature that I want to implement:
> 1. Profile system that link to their facebook or google profile that
> they have.
> 2. Login with gmail account or facebook account
> 3. able to store they login and password to local database
> 4. able to do rating and comments
>
> Can someone suggest anything?
>
> Thanks for your help
>
> --
> 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 and social network

2012-02-22 Thread Alec Taylor
k

If you have issues, read the docs.

If you still have issues, ask on pinax-users mailing-list not django-users.

On Thu, Feb 23, 2012 at 3:57 AM, Lewis Satini wrote:

> and I can only install basic, I had problem getting the advance install
>
>
> On Wed, Feb 22, 2012 at 11:57 AM, Lewis Satini wrote:
>
>> How much experience do you have on pinax. Did you implemented before? do
>> you have the sample site, that I might able to look at? it is difficult to
>> install, because it have some requirement before you install it.
>>
>>
>> On Wed, Feb 22, 2012 at 11:04 AM, Alec Taylor wrote:
>>
>>> Pinax
>>>
>>> http://pinaxproject.com/
>>>
>>> On Thu, Feb 23, 2012 at 1:50 AM, Lewis  wrote:
>>> > I am new in Django. I know it is a good platform.
>>> > I want to know if there's any plug-ins or script that do social
>>> > networking. I research on Pinax, but it seem very difficult to set it
>>> > up. These are the feature that I want to implement:
>>> > 1. Profile system that link to their facebook or google profile that
>>> > they have.
>>> > 2. Login with gmail account or facebook account
>>> > 3. able to store they login and password to local database
>>> > 4. able to do rating and comments
>>> >
>>> > Can someone suggest anything?
>>> >
>>> > Thanks for your help
>>> >
>>> > --
>>> > 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.
>>>
>>>
>>
>>
>> --
>>
>>
>> Artistbean.com <http://mobi.artistbean.com>
>> SMS at (646) 450-6756
>>
>>
>>
>
>
> --
>
>
> Artistbean.com <http://mobi.artistbean.com>
> SMS at (646) 450-6756
>
>
>  --
> 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 and social network

2012-02-23 Thread Alec Taylor
If I keep persisting?

Okay

PINAX!

On Thu, Feb 23, 2012 at 11:49 PM, coded kid  wrote:
> I guess my idea can help you out! Install Django 1.3. After
> installing, try and download packages like omab/social_auth that will
> enable users to log in through facebook, twitter etc. Also download
> agon_ratings that will enable users to rate. You can get those
> packages from djangopackages.com. Use Django comments for making users
> comments. You will have to write some views, models, templates codes
> for somethings. I hope you know about django?
>
> For me Pinax aint helping at all. You still have a long way to go
> though. If you keep persisting, you will get there. I'm also a noob
> though. Feel free to let me know what you think!
>
> Cheers
>
> On Feb 22, 6:53 pm, Alec Taylor  wrote:
>> k
>>
>> If you have issues, read the docs.
>>
>> If you still have issues, ask on pinax-users mailing-list not django-users.
>>
>> On Thu, Feb 23, 2012 at 3:57 AM, Lewis Satini wrote:
>>
>>
>>
>>
>>
>>
>>
>> > and I can only install basic, I had problem getting the advance install
>>
>> > On Wed, Feb 22, 2012 at 11:57 AM, Lewis Satini 
>> > wrote:
>>
>> >> How much experience do you have on pinax. Did you implemented before? do
>> >> you have the sample site, that I might able to look at? it is difficult to
>> >> install, because it have some requirement before you install it.
>>
>> >> On Wed, Feb 22, 2012 at 11:04 AM, Alec Taylor 
>> >> wrote:
>>
>> >>> Pinax
>>
>> >>>http://pinaxproject.com/
>>
>> >>> On Thu, Feb 23, 2012 at 1:50 AM, Lewis  wrote:
>> >>> > I am new in Django. I know it is a good platform.
>> >>> > I want to know if there's any plug-ins or script that do social
>> >>> > networking. I research on Pinax, but it seem very difficult to set it
>> >>> > up. These are the feature that I want to implement:
>> >>> > 1. Profile system that link to their facebook or google profile that
>> >>> > they have.
>> >>> > 2. Login with gmail account or facebook account
>> >>> > 3. able to store they login and password to local database
>> >>> > 4. able to do rating and comments
>>
>> >>> > Can someone suggest anything?
>>
>> >>> > Thanks for your help
>>
>> >>> > --
>> >>> > 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.
>>
>> >> --
>>
>> >> Artistbean.com <http://mobi.artistbean.com>
>> >> SMS at (646) 450-6756
>>
>> > --
>>
>> > Artistbean.com <http://mobi.artistbean.com>
>> > SMS at (646) 450-6756
>>
>> >  --
>> > You received this message because you are subscribed to the Google Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django and social network

2012-02-23 Thread Alec Taylor
Virtualenv is recommended but not required.

You can just install everything to PATH

On Fri, Feb 24, 2012 at 2:29 AM, Lewis Satini  wrote:
> The only problem with pinax that I dont like is to setup the virtual
> environment that make me so headache
>
> The site that you ask me to check out. It's a very good for me. I look after
> that site. 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: django registration

2012-03-05 Thread Alec Taylor
DRY principle is what Django is all about.

Use Pinax instead of developing your own Profile system.

If Pinax profiles don't show exactly what you want, extend them.

Unless you're doing this as a learning exercise?

On Mon, Mar 5, 2012 at 10:46 PM, Stanwin Siow  wrote:
> Even after doing that,
>
> The error still occurs. And my data is still unsaved in the database.
>
> Should i be creating a backend?
>
> Best Regards,
>
> Stanwin Siow
>
>
>
> On Mar 5, 2012, at 7:13 PM, nicolas HERSOG wrote:
>
> I looked at my code in order to notice diffs.
>
> You should add return new_user() after your new_profile.save()
>
>
> On Mon, Mar 5, 2012 at 11:54 AM, Stanwin Siow 
> wrote:
>>
>> Greetings,
>>
>> How do i save a user's profile into the database once i entered the
>> details in my custom registration form?
>>
>> Also right now when i'm testing it out, i get the following error:
>>
>> create_inactive_user() got an unexpected keyword argument
>> 'profile_callback'
>>
>> What could be the problem here?
>>
>> Am i overriding the original form correctly?
>>
>> Appreciate any inputs. Cheers
>>
>> here are the snippets you require:
>>
>> Forms.py
>>
>> from django import forms
>> from r2.models import Keyword
>> from r2.models import UserProfile
>> from registration.forms import RegistrationForm
>> from registration.models import RegistrationProfile
>> from django.utils.translation import ugettext_lazy as _
>> from registration.forms import RegistrationForm, attrs_dict
>>
>> class ProjectSpecificRegistrationForm(RegistrationForm):
>>     keywords = forms.ModelChoiceField(queryset=Keyword.objects.all())
>>     first_name
>> =forms.CharField(widget=forms.TextInput(attrs=attrs_dict),label=_(u'First
>> Name'))
>>     last_name
>> =forms.CharField(widget=forms.TextInput(attrs=attrs_dict),label=_(u'Last
>> Name'))
>>
>> def save(self):
>>     new_user =
>> RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],
>>     password=self.cleaned_data['password1'],
>>     email=self.cleaned_data['email'])
>>     new_profile =
>> UserProfile(user=new_user,username=self.cleaned_data['username'],
>> keywords_subscribed=self.cleaned_data['keywords'],first_name=self.cleaned_data['first_name'],last_name=self.cleaned_data['last_name'])
>>
>>     new_profile.save()
>>
>> project urls.py
>>
>> from r2.registration.views import activate
>> from r2.registration.views import register
>> from r2.forms import ProjectSpecificRegistrationForm
>>
>>     url(r'^accounts/', include('registration.urls')),
>>     #url(r'^accounts/profile/', 'r2.views.profile'),
>>     url(r'^keyword_subscribe/$', 'r2.views.keyword_subscribe'),
>>     url(r'^refresh_list/$', 'r2.views.refresh_list'),
>>     url(r'^test/$', 'r2.views.test'),
>>
>>     #registrations URLS
>>
>> url(r'^activate/(?P\w+)/$',activate,name='registration_activate'),
>>     url(r'^login/$',auth_views.login,{'template_name':
>> 'registration/login.html'}, name='auth_login'),
>>     url(r'^logout/$',auth_views.logout,{'template_name':
>> 'registration/logout.html'},name='auth_logout'),
>>
>> url(r'^password/change/$',auth_views.password_change,name='auth_password_change'),
>>
>> url(r'^password/change/done/$',auth_views.password_change_done,name='auth_password_change_done'),
>>
>> url(r'^password/reset/$',auth_views.password_reset,name='auth_password_reset'),
>>
>> url(r'^password/reset/confirm/(?P[0-9A-Za-z]+)-(?P.+)/$',auth_views.password_reset_confirm,name='auth_password_reset_confirm'),
>>
>> url(r'^password/reset/complete/$',auth_views.password_reset_complete,name='auth_password_reset_complete'),
>>
>> url(r'^password/reset/done/$',auth_views.password_reset_done,name='auth_password_reset_done'),
>>     url(r'^register/$',register, {'form_class' :
>> ProjectSpecificRegistrationForm},  name='registration_register'),
>>
>>     url(r'^register/complete/$',direct_to_template,{'template':
>> 'registration/registration_complete.html'},name='registration_complete'),
>>
>>
>>
>>
>> Best Regards,
>>
>> Stanwin Siow
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email 

Re: django registration

2012-03-05 Thread Alec Taylor
Not sure how large your app is, so had to say.

On Tue, Mar 6, 2012 at 1:59 AM, Stanwin Siow  wrote:
> I don't think using another external app now would be ideal since i want to
> push it to production soon.
>
> From what i found online, it says i'm calling that profile_callback() that
> is in the original forms.py.
>
> But having said that, i think Pinax is quite cool if i've got the time to
> take a look at it.
>
> I've had a brief read.
>
> One thing that's bothering me is if i do use Pinax, do i have to rewrite
> everything again?
>
>
>
> Best Regards,
>
> Stanwin Siow
>
>
>
> On Mar 5, 2012, at 9:53 PM, roy moss wrote:
>
> Pinax is an open-source platform built on the Django Web Framework.
>
> By integrating numerous reusable Django apps and providing starter projects
> and infrastructure tools, Pinax takes care of the things that many sites
> have in common so you can focus on what makes your site different.
>
> Pinax has been used for everything from social networks to conference
> websites, and from intranets to online games.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



Re: django registration

2012-03-05 Thread Alec Taylor
*hard to say

On Tue, Mar 6, 2012 at 2:03 AM, Alec Taylor  wrote:
> Not sure how large your app is, so had to say.
>
> On Tue, Mar 6, 2012 at 1:59 AM, Stanwin Siow  wrote:
>> I don't think using another external app now would be ideal since i want to
>> push it to production soon.
>>
>> From what i found online, it says i'm calling that profile_callback() that
>> is in the original forms.py.
>>
>> But having said that, i think Pinax is quite cool if i've got the time to
>> take a look at it.
>>
>> I've had a brief read.
>>
>> One thing that's bothering me is if i do use Pinax, do i have to rewrite
>> everything again?
>>
>>
>>
>> Best Regards,
>>
>> Stanwin Siow
>>
>>
>>
>> On Mar 5, 2012, at 9:53 PM, roy moss wrote:
>>
>> Pinax is an open-source platform built on the Django Web Framework.
>>
>> By integrating numerous reusable Django apps and providing starter projects
>> and infrastructure tools, Pinax takes care of the things that many sites
>> have in common so you can focus on what makes your site different.
>>
>> Pinax has been used for everything from social networks to conference
>> websites, and from intranets to online games.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.

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



[ImportError] cannot import name `feed`

2012-03-05 Thread Alec Taylor
I keep getting an ImportError saying "cannot import name `feed`".
(pinax-admin basic_project)

I am running latest Pinax (from github) and latest DJango (from SVN),

I have also tried with trunk versions of all dependencies, but I keep
getting this error.

How can I overcome this error?

Thanks for all suggestions,

Alec Taylor

-- 
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: urllib2

2012-03-15 Thread Alec Taylor
Also, quick sort-of side-note:

I recommend checking out the python-requests library as an alternative
to urllib2

http://docs.python-requests.org

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



Theme template designer form

2012-03-16 Thread Alec Taylor
I am creating a website which will allow people to post content with "fluff"!

That is; users will apply choose from a selection of templates to
apply to their content[1] before displaying it on my website.

[1] Content contains no hyperlinks; just images and general
manipulation text manipulation (bold, italic, underline, alignment
[also for images], highlight and text-colour) with full drag-and-drop
support implemented in JavaScript.

Can you recommend some projects and/or modules which will assist in
building this project?

Thanks for all suggestions,

Alec Taylor

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



Templated rich-text egg for Django?

2012-03-22 Thread Alec Taylor
Good morning,

We've all seen document templates in a variety of systems, such as
PowerPoint, MailChimp and Google Docs.

I would like to utilise the same sorts of capabilities on my website.

The following features I require:
• Create a library of document templates
• Allow others to pick a document template to create there document from
• Allow others to swap the template their document has without losing data
• Document authoring in rich-text (e.g. using CKEditor)

(I will probably end up using a full CMS such as Mezzanine around the
whole system.)

Please suggest modules allowing me to do the aforementioned.

Thanks for all recommendations,

Alec Taylor

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



"Expression of Interest" django project

2012-04-03 Thread Alec Taylor
I am thinking to setup an "expression of interest" page with a survey
ending with a "subscribe for updates" button.

The relevant features being:
• View percentages who choice which options in the survey on a graph
• Subscribe for updates equates to newsletter backend
• Twitter Bootstrap theme

It shouldn't be too difficult to build this "from scratch" using:
• django-surveys
• django-chartit
• emencia-django-newsletter
• django-bootstrap

Then I would just put it for anyone to use on either GitHub or BitBucket.

The question I must ask before I begin this project though, is:
"Has someone done this already + have they done it well?"

Thanks for all information,

Alec Taylor

-- 
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: base.css 404ing on Django 1.4a1

2012-04-04 Thread Alec Taylor
Unknown command: 'collectstatic'

Note: I am running the latest official build of Django (1.4) with the
latest dev build of django-staticfiles.

Also of relevance:
> python manage.py help | grep -i "static"
satchmo_copy_static

(yes, I am running a satchmo shop)

On Thu, Apr 5, 2012 at 11:13 AM, swiharta  wrote:
> I had to upgrade my version of django-staticfiles and do collectstatic. Hope
> that helps.
>
>
> On Thursday, February 2, 2012 12:26:47 PM UTC-5, Alec Taylor wrote:
>>
>> Trunk version cannot load Admin CSS.
>>
>> First I tried setting the ADMIN_MEDIA_PREFIX to MEDIA_PREFIX, when
>> that didn't work I tried manual replacing. Yes, I know it has been
>> depreciated and that the css are stored in
>> django\django\contrib\admin\static\admin\css, however it did not work
>> when omitted so I placed that \static\admin\ folder as a subdirectory
>> of my regular static directory.
>>
>> ADMIN_MEDIA_PREFIX is now set to: '/static/admin/' in settings.py.
>>
>> This partially worked, the top of my admin pages now look like this:
>> 
>> > href="/static/admin/css/dashboard.css"/>
>>
>> So dashboard.css is loading fine now, it's just base.css which isn't.
>>
>> How should I go about getting that base.css link to not 404, or
>> *actually* changing that ADMIN_MEDIA_PREFIX?
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>
> --
> 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/-/uT6xUVl_99gJ.
> 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: ecommerce like openCart in php

2012-04-11 Thread Alec Taylor
[Maybe] Mezzanine?

On Thu, Apr 12, 2012 at 10:35 AM, m1chael  wrote:
> i think you're barking up the wrong tree miss Hisham
>
> On Wed, Apr 11, 2012 at 6:34 PM, Randa Hisham  wrote:
>>
>> iam searching for an ecommerce  open source like OpenCart in php
>> -  -
>> Randa Hesham
>> Software Developer
>>
>> Twitter:@ro0oraa
>> FaceBook:Randa Hisham
>>
>> ٍ
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: cannot import name `feed`

2012-04-14 Thread Alec Taylor
Actually it can be fixed by removing django.notifications like so:

Edit `settings.py` by commenting out
"notification.context_processors.notification", within
TEMPLATE_CONTEXT_PROCESSORS and "notification", # must be first from
INSTALLED_APPS. Finally edit urls.py by commenting out
url(r"^notices/", include("notification.urls")), within the patterns
tuple of urlpatterns.

Then edit templates/site_base.html by removing this line:

{% trans
"Notices" %}{% if notice_unseen_count %} ({{ notice_unseen_count }}){%
endif %} wrote:
> You have upgraded to Django 1.4.
>
> I had the same problem when going from Django 1.3.1 to 1.4.
>
> Suggestion:
>
> pip install django==1.3.1
>
> On Mar 6, 7:22 am, Alec Taylor  wrote:
>> I keep getting an ImportError saying "cannot import name `feed`".
>> (pinax-admin basic_project)
>>
>> I am running latest Pinax (from github) and latest DJango (from SVN),
>>
>> I have also tried with trunk versions of all dependencies, but I keep
>> getting this error.
>>
>> How can I overcome this error?
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>
> --
> 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: Using Django to develop a Database?

2012-04-29 Thread Alec Taylor
Quick offside: checkout the NLTK project for processing the information

On Sun, Apr 29, 2012 at 5:05 PM, Kevin A  wrote:
> Hello,
>
> I'm hoping someone can help me with my research.
>
> I've been tasked with helping to construct a Database. Within this
> database will be information (such as their strengths and weaknesses,
> how successful they are, etc.) about various organizations. Most of
> this information is more qualitative in nature.
>
> My question is two-fold:
>
> 1) Can Django be used to create such a database?
>
> 2) If so, once its created, does the user have to have an
> understanding of Python? Or is it possible to code a webpage, that is
> password protected, and then be able to use the webpage like a normal
> website?
>
> I would really appreciate any help/advice you can offer.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

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



How would I go about building an API converter?

2012-05-02 Thread Alec Taylor
I have multiple different APIs with different schemas serialised in XML or
JSON which I need to output as a standardised schema.

Main features needed:

   - *Serialisation to XML and JSON*
   - *Authentication*
  - I.e.: can't get/set data unless you have the correct user+pass
   - *Role/Scope limitation*
  - I.e.: you can't access everything in our database, only what your
  role allows for
   - *Get/set (conversion) between different schemas*
  - I.e.: No matter the input API, you can get it formatted in
  whichever output API you request

Is this the sort of problem Slumber <http://slumber.in/> with
TastyPie<http://tastypieapi.org/>would be best for?

Or are there a different libraries you'd recommend?

Thanks for all suggestions,

Alec Taylor

-- 
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 would I go about building an API converter?

2012-05-02 Thread Alec Taylor
On Thu, May 3, 2012 at 12:52 AM, HarpB  wrote:
> I am a big fan of TastyPie. But I don't understand your following
> requirement:
>
> Get/set (conversion) between different schemas
>
> I.e.: No matter the input API, you can get it formatted in whichever output
> API you request
>
> Are you simply trying to create a unified interface for all of you existing
> APIs? If so, are they using Django models?

They seem to be mostly written from C#, all the information they are
giving me is an auto-generated schema page with set/get examples in
SOAP [for one service] and XML [for the other]. I suspect that a few
of the others will be in JSON though.

> TastyPie would only be useful for you if you have existing Django Models.
> You could still use it without having Django models, but then you would
> have to write lot more of the api code yourself. TastyPie is a full-featured,
> drop-in API system. It is meant to simply included into your existing
> code, your attach it to your Django model and it will serve the data
> associated to the models. It provides all of the RESTful options: GET,
> POST, DELETE and PUT.
>
>
> Django-Piston also makes use of django models, but it does not solely relies
> on it. It provides a very basic interface (in comparison to TastyPie) and
> you would need to write all of the RESTful request handles yourself.
>
>
> Both TastyPie and Piston have authentication and authorization system.
>

The functionality I'm providing is as follows:

Server1 >[send as SOAP 1.1]>[My Server]>[Server3 receives as XML in
Server3 schema]
Server3>[Send as XML]>[My Server]>[Server1 receives as SOAP 1.1 in
Server1 schema]

However since they will still need to access the data on demand (and
not wait for a set/get operation from another party) I will need to
create models (database) storing all information received.

What would be the best way of doing this?

Would TastyPie still be a good choice, or would Django-Piston [or some
other] better suit this problem?

Thanks for all suggestions,

Alec Taylor

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



Re: Google Drive with Django?

2012-05-09 Thread Alec Taylor
This isn't helpful?

https://developers.google.com/drive/examples/python

On Thu, May 10, 2012 at 2:16 PM, Jordon Wing  wrote:
> Hey guys,
> I'm trying to integrate Google Drive into my app, and I'm having some trouble 
> using OAuth2. I'm not sure if any of you have played with the SDK, but if 
> anyone has, what library (if any) did you use? Is there anything that 
> simplifies the 200+ lines of code they have in the examples?
>
> Link to the SDK: https://developers.google.com/drive
>
> 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/-/qwx3ZJG5MYgJ.
> 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: Prototype of a web based code editor for Django

2012-05-11 Thread Alec Taylor
It looks alright, be sure to add code highlighting and debugging to
the online text editor (http://ace.ajax.org/).

Also need restart buttons and whatnot

On Sat, May 12, 2012 at 12:06 AM, Timothy Clemans
 wrote:
> I've created a basic web based code editor for Django, see
> http://198.144.178.112:8000
>
> Would you use this? What features do you want? Do you want to help develop
> 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/-/QeOZc9cy9R4J.
> 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.



Web-framework+db with the widest scalability?

2012-05-12 Thread Alec Taylor


Disclosure: I have posted this on 
stackoverflowand 
comp.lang.python
.

I am building a project requiring high performance and scalability, 
entailing:

   - Role-based 
authenticationwith 
   
API-keylicensing
 to access data of specific users
   - API 
exposed with 
   REST  
(XML, 
   JSON ), 
XMLRPC, 
   JSONRPC  and 
SOAP
   - "Easily" configurable getters and 
settersto create APIs accessing 
the same data but with input/output in different 
   schemas 

A conservative estimate of the number of tables—often whose queries require 
joins—is: 20.

Which database type—e.g.: NoSQL  or 
DBMS
—key-value data store or 
object-relational 
database —e.g.: 
Redis  or 
PostgreSQL—and 
web-framework —e.g. 
Django , 
Web2Pyor 
Flask —would you recommend?
Thanks for all suggestions

-- 
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/-/fsXn3S3C48oJ.
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 setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-05-12 Thread Alec Taylor
Without gcc you can't do anything yourself.

Extract the binary out of the Python package for your platform

Alternatively I think this has a Python interpreter:
http://portablelinuxapps.org/development/wireshark

Might be only 2.6 though...


On Sat, May 12, 2012 at 8:29 PM, Dan Santos  wrote:

> *1.)*
> Hi I have downloaded this zip file:  Python-2.7.3.tgz
>
> *2.)*
> And tried to compile it, I think it's called by doing this command:
>
> dan@debian:~/usr-32/Python-2.7.3$ *./configure --prefix=/home/dan/usr-32*
> *
> *
> checking for --enable-universalsdk... no
> checking for --with-universal-archs... 32-bit
> checking MACHDEP... linux2
> checking EXTRAPLATDIR...
> checking machine type as reported by uname -m... x86_64
> checking for --without-gcc... no
> checking for gcc... no
> checking for cc... no
> checking for cl.exe... no
> configure: error: in `/home/dan/usr-32/Python-2.7.3':
> configure: error: no acceptable C compiler found in $PATH
> See `config.log' for more details
>
>
> How do I deal with this on my shared host account with no root access?
>
> --
> 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/-/i_yNbeu7jQgJ.
> 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: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-05-12 Thread Alec Taylor
You'll need the relevant C library

(zlib)

Or there is certainly a deb or rpm for it

On Sat, May 12, 2012 at 9:14 PM, Dan Santos  wrote:

> Thanks for the tips they will come in handy in the future! :)
>
> It seems like my web host did a kernel update or something and then gcc
> disappeared because it worked before.  But they have fixed that problem
> now.  So here's my real problem.
>
>
> dan@debian:~$ *cat .bash_aliases *
> alias py27='/home/dan/usr-32/Python-2.7.3/./python'
>
>
> dan@debian:~/usr-32$ *py27 virtualenv.py ~/.virtualenvs/ENV2*
> Traceback (most recent call last):
>   File "virtualenv.py", line 17, in 
> import zlib
> *ImportError: No module named zlib*
>
>
> How do I import zlib?
> I tried this yesterday but it didn't work.
> dan@debian:~/usr-32/Python-2.7.3$ *./configure --prefix=/home/dan/usr-32
> --with-zlib*
>
>
> On Saturday, May 12, 2012 12:45:09 PM UTC+2, Alec Taylor wrote:
>>
>> Without gcc you can't do anything yourself.
>>
>> Extract the binary out of the Python package for your platform
>>
>> Alternatively I think this has a Python interpreter:
>> http://portablelinuxapps.org/**development/wireshark<http://portablelinuxapps.org/development/wireshark>
>>
>> Might be only 2.6 though...
>>
>>
>> On Sat, May 12, 2012 at 8:29 PM, Dan Santos wrote:
>>
>>> *1.)*
>>> Hi I have downloaded this zip file:  Python-2.7.3.tgz
>>>
>>> *2.)*
>>> And tried to compile it, I think it's called by doing this command:
>>>
>>> dan@debian:~/usr-32/Python-2.**7.3$ *./configure
>>> --prefix=/home/dan/usr-32*
>>> *
>>> *
>>> checking for --enable-universalsdk... no
>>> checking for --with-universal-archs... 32-bit
>>> checking MACHDEP... linux2
>>> checking EXTRAPLATDIR...
>>> checking machine type as reported by uname -m... x86_64
>>> checking for --without-gcc... no
>>> checking for gcc... no
>>> checking for cc... no
>>> checking for cl.exe... no
>>> configure: error: in `/home/dan/usr-32/Python-2.7.**3':
>>> configure: error: no acceptable C compiler found in $PATH
>>> See `config.log' for more details
>>>
>>>
>>> How do I deal with this on my shared host account with no root access?
>>>
>>> --
>>> 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/-/i_**yNbeu7jQgJ<https://groups.google.com/d/msg/django-users/-/i_yNbeu7jQgJ>
>>> .
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users+unsubscribe@*
>>> *googlegroups.com .
>>> For more options, visit this group at http://groups.google.com/**
>>> group/django-users?hl=en<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/-/STsg9RKgrt8J.
>
> 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: Use Django to implement my GUI!

2012-05-13 Thread Alec Taylor
You could always create a responsive interface—e.g.: using
twitter-bootstrap—and then distribute it onto every platform.

Web (obviously): Django templates or "standard" web frontend—using
e.g.: REST, XMLRPC or JSONRPC—that calls functions and serialises data
in a less data heavy way (on clients' end)
Mobiles: Adobe's open-source PhoneGap
Desktops: Adobe Air, HTML Applications (Windows) and MacGap (OSX) are
all possibilities... however I would recommend checking out Nokia's
open-source Qt, and distributing your product with a renderer. In
essense, you would be distributing your own browser without your page
as homepage, and which can only access what you allow (e.g.:
*.mydomain.com/*). See their webkit-fancybrowser example for an idea
of how this could be done.

-- 
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 News App

2012-05-14 Thread Alec Taylor
Mezzanine might be a bit of fun to work with

Also note that Django was developed for a news room, so you should be
fine with it as is (if you learn how to use it... maybe go through the
docs)


On Tue, May 15, 2012 at 12:28 AM, armagan  wrote:
> Hi,
> I am trying to practice a news app. I've tried to set up Django-cms
> app, it's running but it's a bit complex for a news application. And
> now I started to set up zinnia blog app.  Do you suggest another one?
>
> --
> 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: Use Django to implement my GUI!

2012-05-14 Thread Alec Taylor
No reason to do anything crazy like that.

Forget SOCKETS, use HTTP or HTTPS.

Clientside/mobileside/webside build in HTML+CSS+JS.

#win

On Tue, May 15, 2012 at 9:18 AM, Eugène Ngontang  wrote:
> Hi Jani!
>
> I haven't seen the last statements of your post, whre you say I'm not really
> clear and that i'm building a non-http GUI using Django.
>
>
> OK let's stay on the rendering issue only, and specify things simply. This
> is a simple description of the architecture I want to set up :
>
> - A Client (not a user interface). Client here means a module which is
> installed in a remote computer and communicate with the server via socket.
>
> - A server listening from several remote client (Here i'm not talking yet
> about http request), and receive informatons from them. In fact client must
> be doing actions and send informations about their actions to the server. In
> the oder hand data to be processed by each client is pushed/dispatched by
> the server.
>
> - And admin (not Django Admin, but admin in the sens of my app), destined to
> be the module allowing use of the application. Then the Admin module is part
> of the server and will proviede a GUI for manipulating data in the data
> base. It's in this GUI that users of the application will enter their
> request, by filling a form or clicking a link for exemple. And data from the
> GUI could be stored in the data base, while being send to the remote clients
> (not to be displayed by the client, but to be processed). In the same way,
> informations comming from those clients to the server have to be diplayed in
> the GUI.
>
> With a graphical GUI, The server could have a reference to an object
> representing my GUI, and it will be done.
> But I choose a web GUI for view and administration. It's where Django comes.
>
> And my problem is to make my server being running a network thread,
> receiving data from the GUI(web browser) and sending informations update to
> the GUI (for web page content).
>
> This is really my issue. If all the actions of my server depended on my GUI
> request (http request), I could do what I like behind when handling a http
> request, but while managing http:8080 connexions, the application is running
> another process/thread on another TCP/UDP port.
>
> And yes I want a web GUI.
>
> Is why I'm looking the best way to achieve that. We can exclude Django web
> server, as it will not be used in production for the application deployment.
>
> Hope now it's clear for you, and more for the other users.
>
> Thanks!
>
>
> 2012/5/13 Jani Tiainen 
>>
>> Hi,
>>
>> There is several ways to achieve what you maybe want to do. One of the
>> simplest way is separate frontend (your userinterface) and server backend.
>> You can build your Django application as a service (xml-rpc, json-rpc,
>> restful). That would give you advantage to choose whatever frontend you
>> like. Of course it would add some overhead.
>>
>> On Sun, May 13, 2012 at 1:14 PM, Eugene NGONTANG 
>> wrote:
>>>
>>> Hi!
>>>
>>> I'm a python developper, but new in django.
>>>
>>> I'm devolopping a multi clients-server application.
>>>
>>> The server and the clients are communicating via sockets, The server
>>> receive somme states from clients, and display them in the User
>>> interface.
>>> In the other hand, the server has to send a message(packet) to the
>>> client when an event  occurs in the GUI, and data are stored in a
>>> database.
>>>
>>
>> Note that Django is mainly built for web (HTTP protocol based)
>> applications. In such an environment you run two different things: your GUI
>> (usually browser) that is totally ignorant of server side (Django). Then you
>> send request to some URL, Django routes it to some view and view produces
>> again next output to be displayed in GUI (browser again). One of the common
>> functions in the view is database manipulation.
>>
>>>
>>> Then I choose to make a web interface where data could be viewed and
>>> manipulated. And I discovered Django, which fit all my needs. I tested
>>> and liked the framework.
>>>
>>> My questions are:
>>> - Can I override the djando admin methods so that i can not only
>>> customized my views and html page, but also manipulate objects in
>>> database, so that i can do another action when catching an  event in
>>> the GUi.
>>> For example, taking the django admin tutorial, I would like to do and
>>> action like sending a message the user choose "add a poll". How can I
>>> do those things? Cause I noticed that method that alter data in data
>>> base are part of django admin module and cannot be overriden
>>>
>>
>> You shouldn't "fight against admin". If something cannot be done in the
>> admin you usually get a way with writing your own stuff.
>>
>>>
>>> - To achieve what I want, i would like to run my server engine and my
>>> django admin in two separated threads. How do i run my admin module in
>>> a thread? Cause till now i'm using the command line "python manage.py
>>> runserver
>>
>>
>> Again your GUI woul

Re: Use Django to implement my GUI!

2012-05-16 Thread Alec Taylor
On Wed, May 16, 2012 at 10:49 PM, Frank Stüss  wrote:
> or maybe you might have a look at http://pyjs.org/
> which could help you having an event aware client app in your browser.
> Served by and with django.

I'm impressed

(just read the exec summary from homepage)

>
> Am Sonntag, den 13.05.2012, 17:14 +0400 schrieb Alireza Savand:
>> No, i posted django-tastypie not tastypie itself and it's easy to use.
>> Anyway if i'm implementing GUI based i would make it website, since
>> it's an advantages of SaaS.
>> But using client app[desktop-app] and a server-app[django] and having
>> multiply client and ... makes maintaining like a nightmare.
>> All i knew was that, Despite that you asked several question and i
>> just claimed to help in one of them :D
>>
>> On Sun, May 13, 2012 at 4:06 PM, Eugène Ngontang 
>> wrote:
>>         Yes, I can see tastypie is a good service, that even support
>>         REST protocol.
>>
>>         But I'd firt basically implement my gui with django and when i
>>         will master well django, i could use tastypie, and turn my
>>         server to support REST, it will be a good thing.
>>
>>         But please let's keep using only django for the begining.
>>
>>         Thanks.
>>
>>
>>         2012/5/13 Alireza Savand 
>>                 https://github.com/toastdriven/django-tastypie
>>
>>
>>                 On Sunday, May 13, 2012 2:14:36 PM UTC+4, Eugene
>>                 NGONTANG wrote:
>>                         Hi!
>>
>>                         I'm a python developper, but new in django.
>>
>>                         I'm devolopping a multi clients-server
>>                         application.
>>
>>                         The server and the clients are communicating
>>                         via sockets, The server
>>                         receive somme states from clients, and display
>>                         them in the User
>>                         interface.
>>                         In the other hand, the server has to send a
>>                         message(packet) to the
>>                         client when an event  occurs in the GUI, and
>>                         data are stored in a
>>                         database.
>>
>>                         Then I choose to make a web interface where
>>                         data could be viewed and
>>                         manipulated. And I discovered Django, which
>>                         fit all my needs. I tested
>>                         and liked the framework.
>>
>>                         My questions are:
>>                         - Can I override the djando admin methods so
>>                         that i can not only
>>                         customized my views and html page, but also
>>                         manipulate objects in
>>                         database, so that i can do another action when
>>                         catching an  event in
>>                         the GUi.
>>                         For example, taking the django admin tutorial,
>>                         I would like to do and
>>                         action like sending a message the user choose
>>                         "add a poll". How can I
>>                         do those things? Cause I noticed that method
>>                         that alter data in data
>>                         base are part of django admin module and
>>                         cannot be overriden
>>
>>                         - To achieve what I want, i would like to run
>>                         my server engine and my
>>                         django admin in two separated threads. How do
>>                         i run my admin module in
>>                         a thread? Cause till now i'm using the command
>>                         line "python manage.py
>>                         runserver"
>>
>>                         - I also tried to overide tables name, and
>>                         foreign keys names. Could
>>                         you guys provide me a true life example?
>>
>>                         - And now in the production step, I would like
>>                         you guys to tell me
>>                         what to choose for serving files. I would like
>>                         to with your experience
>>                         what's better between running a unicorn server
>>                         or apache with mod_wsgi
>>
>>                         I don't know if i'm clear, but i hope. In
>>                         brief I'd like to use the
>>                         django framework features to design my Gui
>>                         like i want, customize
>>                         interactions between the gui and the backend,
>>                         and choose a good web
>>                         server for the production.
>>
>>                         Thank you for advance
>>
>>                 --
>>                 You received this message because you are subsc

Re: Use Django to implement my GUI!

2012-05-16 Thread Alec Taylor
Oh right, it's just Pyjamas.

Still, annoyed I didn't think to recommend it first!


On Thu, May 17, 2012 at 12:02 AM, Alec Taylor  wrote:
> On Wed, May 16, 2012 at 10:49 PM, Frank Stüss  wrote:
>> or maybe you might have a look at http://pyjs.org/
>> which could help you having an event aware client app in your browser.
>> Served by and with django.
>
> I'm impressed
>
> (just read the exec summary from homepage)
>
>>
>> Am Sonntag, den 13.05.2012, 17:14 +0400 schrieb Alireza Savand:
>>> No, i posted django-tastypie not tastypie itself and it's easy to use.
>>> Anyway if i'm implementing GUI based i would make it website, since
>>> it's an advantages of SaaS.
>>> But using client app[desktop-app] and a server-app[django] and having
>>> multiply client and ... makes maintaining like a nightmare.
>>> All i knew was that, Despite that you asked several question and i
>>> just claimed to help in one of them :D
>>>
>>> On Sun, May 13, 2012 at 4:06 PM, Eugène Ngontang 
>>> wrote:
>>>         Yes, I can see tastypie is a good service, that even support
>>>         REST protocol.
>>>
>>>         But I'd firt basically implement my gui with django and when i
>>>         will master well django, i could use tastypie, and turn my
>>>         server to support REST, it will be a good thing.
>>>
>>>         But please let's keep using only django for the begining.
>>>
>>>         Thanks.
>>>
>>>
>>>         2012/5/13 Alireza Savand 
>>>                 https://github.com/toastdriven/django-tastypie
>>>
>>>
>>>                 On Sunday, May 13, 2012 2:14:36 PM UTC+4, Eugene
>>>                 NGONTANG wrote:
>>>                         Hi!
>>>
>>>                         I'm a python developper, but new in django.
>>>
>>>                         I'm devolopping a multi clients-server
>>>                         application.
>>>
>>>                         The server and the clients are communicating
>>>                         via sockets, The server
>>>                         receive somme states from clients, and display
>>>                         them in the User
>>>                         interface.
>>>                         In the other hand, the server has to send a
>>>                         message(packet) to the
>>>                         client when an event  occurs in the GUI, and
>>>                         data are stored in a
>>>                         database.
>>>
>>>                         Then I choose to make a web interface where
>>>                         data could be viewed and
>>>                         manipulated. And I discovered Django, which
>>>                         fit all my needs. I tested
>>>                         and liked the framework.
>>>
>>>                         My questions are:
>>>                         - Can I override the djando admin methods so
>>>                         that i can not only
>>>                         customized my views and html page, but also
>>>                         manipulate objects in
>>>                         database, so that i can do another action when
>>>                         catching an  event in
>>>                         the GUi.
>>>                         For example, taking the django admin tutorial,
>>>                         I would like to do and
>>>                         action like sending a message the user choose
>>>                         "add a poll". How can I
>>>                         do those things? Cause I noticed that method
>>>                         that alter data in data
>>>                         base are part of django admin module and
>>>                         cannot be overriden
>>>
>>>                         - To achieve what I want, i would like to run
>>>                         my server engine and my
>>>                         django admin in two separated threads. How do
>>>                         i run my admin module in
>>>                         a thread? Cause till now i'm using the command
>>>                         line "python manage.py
>>>                         runserver"
>>>
>>>                         - I also tried to overide tables name, and
&

Re: How do you install Django on a shared hosting without root access?

2012-05-17 Thread Alec Taylor
You could wget/curl over a version of
http://code.google.com/p/pts-mini-gpl/wiki/StaticPython

On Thu, May 17, 2012 at 6:21 PM, Dan Santos  wrote:
> Sorry I celebrated too early :( not sure if my local webhost can pull it of
> entirely?
> But they have been very forthcoming so far.
>
> I've just got SSH access with limited privileges.  And saw that I only have
> Python 2.4 and Django 1.3.
> But I want to run Django 1.4.
> And I couldn't setup virtualenv.py properly when I ran it on my shared
> hosting account :(
> http://www.virtualenv.org/en/latest/index.html
>
> It's not easy setting up Django on shared hosting, so much troubles. :(
>
>
>
>
>
> On Sunday, May 13, 2012 11:15:28 PM UTC+2, Gerald Klein wrote:
>>
>> What host?
>>
>>
>> thanks
>>
>> --jerry
>>
>> On Sun, May 13, 2012 at 2:49 PM, Dan Santos  wrote:
>>>
>>> I forced my local web host (twisted their arm) and the day after they
>>> created a new procedure for setting up Django without having to use root
>>> access.
>>>
>>> Problem solved :)
>>>
>>>
>>>
>>> On Saturday, May 12, 2012 8:39:27 PM UTC+2, Dan Santos wrote:

 Hi I'm confused about how to setup Django on my shared hosting account
 without using root.  They don't have Django or Python support so I will 
 have
 to install everything from scratch I guess.

 Do I install things in this order for shared hosting, or have I messed
 up the order when not using root?

 1. Python 2.7
 2. virtualenv.py
 http://www.virtualenv.org/en/latest/index.html

 3. (ENV1)$ pip install django


>>> --
>>> 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/-/JbtefCDiKMIJ.
>>> 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.
>>
>>
>>
>>
>> --
>>
>> Gerald Klein DBA
>>
>> contac...@geraldklein.com
>>
>> www.geraldklein.com
>>
>> j...@zognet.com
>>
>> 708-599-0352
>>
>>
>> Linux registered user #548580
>>
>>
>>
> --
> 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/-/hog5iooCFXAJ.
>
> 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: Use Django to implement my GUI!

2012-05-18 Thread Alec Taylor
Dde

That architecture diagram shows exactly your problem.

You are thinking about this problem incorrectly.

- Server: nginx [or whatever] with Django
- Client: web-browser
- Admin:  Client: web-browser

#done

On Fri, May 18, 2012 at 1:36 PM, Eugène Ngontang  wrote:
> Hi Guys!
>
> I've been busy a bit, I'm back to thread with the high level architecture.
> Attached here is a diagram, just to understand what i meant.
>
> Don't pay attention for object I use to describe modules or architecture
> components.
>
> Now you will be able to understand what I mean by the server module, the
> admin module, and the client module of my architecture.
>
> As you could see on the diagram, the admin module is installd on the
> server(where the server module is installed) and is destined to provide
> views to the GUI.
> The clients receive and send data to the server.
> When the admin make some actions, some clients are notifed, and when client
> send informations admin (GUi is notified).
>
> Now two things come in my mind when I was thinking :
>
> - First I could stay in the way I want the server to use HTTP for the admin
> side, and another protocol to communicate with client. In that way the Admin
> Module (Django) will alter and read data from data base. and the server
> module will alter and read data from database. Then each information
> retrievement will lead in reading database since informations could have
> been changed. You can that's really heavy.
>
> - Second do all things in http. Mean that my server is just a web
> application undertanding HTTP (I will the use django for that). The server
> will serve request depending on the type of request, and each client will
> communicate with the server using HTTP.  Then server will define pages/urls
> for admin (to be sent to the GUI), and pages/urls  for clients.
> By this way, the only relation between my modules will be the protocol (HTTP
> for the instance) and they could be implemented in what ever language we
> like. The sever will run asynchronously for admin and clients.
>   The admin will then be just an interface to wich convert data to the right
> display format for the GUI. And the GUI could be any type, and for the web
> interface type I will use DJANGO for my Admin module.
>    I will then also have to develop a http client for my client module.
>
> Actuallu I'm going to take the second choice, since it lets all the charge
> for read and write database to the server, which could run and publish
> informations asynchronously(websocket could help here).
>
> I precise that I'm not a web architect or designer, but i understand
> software architecture. I'm really a system and network engineer, with good
> developpement skill but not to much in web.
>
> Look now my architecture diagram and tell me if what I'm describing in the
> second item fit. And give idea if you have, about libraiies and or framwork
> that could help going fast and easy.
> I thing I will use django and green unicorn.
>
> Thanks for your attention.
>
>
>
> 2012/5/16 Alec Taylor 
>>
>> Oh right, it's just Pyjamas.
>>
>> Still, annoyed I didn't think to recommend it first!
>>
>>
>> On Thu, May 17, 2012 at 12:02 AM, Alec Taylor 
>> wrote:
>> > On Wed, May 16, 2012 at 10:49 PM, Frank Stüss 
>> > wrote:
>> >> or maybe you might have a look at http://pyjs.org/
>> >> which could help you having an event aware client app in your browser.
>> >> Served by and with django.
>> >
>> > I'm impressed
>> >
>> > (just read the exec summary from homepage)
>> >
>> >>
>> >> Am Sonntag, den 13.05.2012, 17:14 +0400 schrieb Alireza Savand:
>> >>> No, i posted django-tastypie not tastypie itself and it's easy to use.
>> >>> Anyway if i'm implementing GUI based i would make it website, since
>> >>> it's an advantages of SaaS.
>> >>> But using client app[desktop-app] and a server-app[django] and having
>> >>> multiply client and ... makes maintaining like a nightmare.
>> >>> All i knew was that, Despite that you asked several question and i
>> >>> just claimed to help in one of them :D
>> >>>
>> >>> On Sun, May 13, 2012 at 4:06 PM, Eugène Ngontang 
>> >>> wrote:
>> >>>         Yes, I can see tastypie is a good service, that even support
>> >>>         REST protocol.
>> >>>
>> >>>         But I'd firt basically implement my gui with django and when i
>> >>>         will maste

Re: Django in mobile devices

2012-05-19 Thread Alec Taylor
I use Phonegap and Django

I created my mobile app using my exposed REST API with JSON calls in JavaScript

On Sat, May 19, 2012 at 7:08 PM, Phang Mulianto  wrote:
> Hi Mario,
>
> thanks for your response.
>
> i already know about sl4a .
>
> what i mean is, are there any known project that use django / mini django
> framework parts to build apps in mobile device, in this case android only or
> even multi device.
>
> this will be nice ... do mvc in mobile use python...   i mean ruby people
> already done it.
>
>
>
>
> On Sat, May 19, 2012 at 4:20 PM, Mario Gudelj 
> wrote:
>>
>> Have a look at http://www.linuxjournal.com/article/10940
>>
>>
>> Also http://thedjangoforum.com/board/thread/879/django-python-on-a-standalone-android/
>>
>> On 19 May 2012 00:54, Phang Mulianto  wrote:
>>>
>>> HI all,
>>>
>>> i recently see rhomobile.com , which running ruby in mobile devices, and
>>> phonegap which use javascript.
>>>
>>> do anyone aware of the equivalent python / django can be used for mobile
>>> devices..
>>>
>>> i am thinking about create app for the mobile client using web technology
>>> without go deeper in java.
>>>
>>> any comment appreciated.
>>>
>>>
>>> Thanks,
>>>
>>> Mulianto
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
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: JQuery Django

2012-05-23 Thread Alec Taylor
This might be helpful: http://www.djangobook.com/en/beta/chapter04/

On Wed, May 23, 2012 at 4:06 PM, cocoza4  wrote:
> I'm new to Django.
> How can i connect Django with jQuery?
>
> is there any additional tool that i need to install?
>
> could you show me a sample code also?
>
> Thanks in advance.
>
> --
> 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/-/OIGnCdgMJooJ.
> 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: Is there a custom forms component of python-web?

2012-05-24 Thread Alec Taylor
On Thu, May 24, 2012 at 8:29 PM, kevon wang  wrote:
> what is plonk. ?
>

Onomatopoeia


See: http://www.urbandictionary.com/define.php?term=plonk

-- 
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: PyPm / Django 1.4?

2012-06-04 Thread Alec Taylor
On Mon, Jun 4, 2012 at 2:48 AM, Aaron C. de Bruyn  wrote:
> On Sat, Jun 2, 2012 at 9:43 AM, Bill Freeman  wrote:
>> Have you considered running under a virtualenv and pip installing
>> exactly what you need?
>
> Yes--that's what I may end up doing.  Just trying to remove a few
> steps from the 'install procedure' for a user that already doesn't
> like the CLI.
>
> Thanks,
>
> -A
>

If the CLI is the only thing stopping others from setting up the
server, then why not write up a neat little installer with a desktop
shortcut to run the Django server?

Easiest method would be to use NSIS to create the installer,
bootstrapping on the packages needed from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

Alternatively if you have a bit more time on hand (or your compilers
and whatnot are already setup) bootstrap MinGW onto your NSIS and set
the PATH and modify the necessary Python files accordingly. Then you
wouldn't need to bootstrap anything but distribute
(http://packages.python.org/distribute/) and then you can just
silently run all the pip's and have it virtualenv'd all the way down
to a Desktop shortcut :)

-- 
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: Graphs in django

2012-06-11 Thread Alec Taylor
Put it in the template or whatnot

Might be an easier job for a javascript graph library, or even processing-js

On Tue, Jun 12, 2012 at 3:40 PM, Satvir Toor  wrote:
> here is code to display sin curve
>
> from pylab import *
>
> t = arange(0.0, 2.0, 0.01)
> s = sin(2*pi*t)
> plot(t, s, linewidth=1.0)
>
> xlabel('time (s)')
> ylabel('voltage (mV)')
> title('About as simple as it gets, folks')
> grid(True)
> show()
>
>
> its working well but the output is being display in different
> window..But i need to display this curve in browser window. Please
> tell me what changes i have to make in this code
>
> --
> Satvir Kaur
>
> --
> 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: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-01 Thread Alec Taylor
+! :]

On Sun, Jul 1, 2012 at 5:52 PM, ionic drive  wrote:
> +1 great!
>
>
> On Sat, 2012-06-30 at 16:10 +0100, Cal Leeming [Simplicity Media Ltd] wrote:
>
> Hi all,
>
>
>
> As some of you know, I did a live webcast last year (July 2011) on our LLG
> project, which explained how we overcome some of the problems associated
> with large data processing.
>
>
>
> After reviewing the video, I found that the sound quality was very poor, the
> slides weren't very well structured, and some of the information is now out
> of date (at the time it was 40mil rows, now we're dealing with 700+mil
> rows).
>
>
>
> Therefore, I'm considering doing another live webcast (except this time
> it'll be recorded+posted the next day, the stream will be available in
> 1080p, it'll be far better structured, and will only last 50 minutes).
>
>
>
> The topics I'd like to cover are:
>
>
>
> * Bulk data processing where bulk_insert() is still not viable (we went from
> 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still using the
> ORM - no raw sql here!!)
>
> * Applying faux child/parent relationship when standard ORM is too expensive
> (allows for ORM approach without the cost)
>
> * Applying faux ORM read-only structure to legacy applications (allows ORM
> usage on schemas that weren't properly designed, and cannot be changed - for
> example, vendor software with no source code).
>
> * New Relic is beautiful, but expensive. Hear more about our plans to make
> an open source version.
>
> * Appropriate use cases for IAAS vs colo with SSDs.
>
> * Percona is amazing, some of the tips/tricks we've learned over.
>
>
>
> If you'd like to see this happen, please leave a reply in the thread - if
> enough people want this, then we'll do public vote for the scheduled date.
>
>
>
> Cheers
>
>
>
> Cal
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-01 Thread Alec Taylor
Sounds good, but have you considered using Google+ Hangouts?

On Mon, Jul 2, 2012 at 1:09 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Wow - glad to see there's people interested in this!
>
> Here is the schedule, could everyone please select which days/times they are
> available (enter more than one if possible)
>
> http://www.doodle.com/8ptehyqr6uezhtsy
>
> I'll leave the schedule open until 14th July, whichever slot gets the most
> votes wins.
>
> Given our awful experiences with conferencing software, we'll probably be
> using livestream, and a backup stream from one of our own servers - both
> have a maximum capacity of 50 users at 720p.
>
> Cal
>
> On Sat, Jun 30, 2012 at 4:10 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
>>
>> Hi all,
>>
>> As some of you know, I did a live webcast last year (July 2011) on our LLG
>> project, which explained how we overcome some of the problems associated
>> with large data processing.
>>
>> After reviewing the video, I found that the sound quality was very poor,
>> the slides weren't very well structured, and some of the information is now
>> out of date (at the time it was 40mil rows, now we're dealing with 700+mil
>> rows).
>>
>> Therefore, I'm considering doing another live webcast (except this time
>> it'll be recorded+posted the next day, the stream will be available in
>> 1080p, it'll be far better structured, and will only last 50 minutes).
>>
>> The topics I'd like to cover are:
>>
>> * Bulk data processing where bulk_insert() is still not viable (we went
>> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still
>> using the ORM - no raw sql here!!)
>> * Applying faux child/parent relationship when standard ORM is too
>> expensive (allows for ORM approach without the cost)
>> * Applying faux ORM read-only structure to legacy applications (allows ORM
>> usage on schemas that weren't properly designed, and cannot be changed - for
>> example, vendor software with no source code).
>> * New Relic is beautiful, but expensive. Hear more about our plans to make
>> an open source version.
>> * Appropriate use cases for IAAS vs colo with SSDs.
>> * Percona is amazing, some of the tips/tricks we've learned over.
>>
>> If you'd like to see this happen, please leave a reply in the thread - if
>> enough people want this, then we'll do public vote for the scheduled date.
>>
>> Cheers
>>
>> Cal
>
>
> --
> 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.



  1   2   >