Re: Noob question

2012-08-02 Thread Demian Brecht
What, exactly are you confused about? What is your question?

2012/8/2 Robert 

> Hi all, I´ve developed that model, but i´m quite confused about the
> sintax, looks a bit freaky... Hers my code:
>
> from django.db import models
>
> ##
>  PROJETOS 
> ##
>
> class Projetos(models.Model):
>
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
>
> #FIELDS
> i_motivo_oferta = models.IntegerField()
> s_nome_projeto = models.CharField("Projeto",max_length=100)
> s_integrador = models.CharField("Integrador",max_length=100)
> s_contend_provider = models.CharField("Contend
> Provider",max_length=100)
> s_marca_servico = models.CharField("Marca do
> Serviço",max_length=100)
>
> ABRANGENCIA = (('R', 'Regional'),('N', 'Nacional'),)
> s_abrangencia = models.CharField("Abrangência",max_length=2,
> choices=ABRANGENCIA)
>
> TIPO_SERVICO = (('C', 'Cross'),('W', 'White Label'),)
> i_id_tipo_servico =  models.CharField("Tipo de
> Serviço",max_length=2, choices=TIPO_SERVICO)
>
> i_valor_retry = models.IntegerField("Valor de retry")
> i_la =  models.IntegerField("Large account")
> d_lanc_comercial = models.DateField("Lançamento comercial")
> d_term_projeto = models.DateField("Término do projeto")
>
> ???
> ??? PLANOS_DE_MIDIA = (('I', 'Internet'), ('T', 'TV'), ('R',
> 'Radio'), ('R', 'Revista'), ('R', 'Midia Exterior'), ('R', 'Outros'),)
> ??? i_plan_midia = models.CharField("Plano de midia",max_length=2,
> choices=PLANOS_DE_MIDIA)
> ???
>
> d_data_acordo = models.DateField("Data de Acordo")
> d_data_revisao = models.DateField("Data de Revisão")
> i_ura_id =  models.IntegerField("URA ID")
> s_ura_desc = models.CharField("Descição URA",max_length=200)
>
> #FOREIGN KEY "Perfil_Servico"
> i_id_perfil_servico = models.ForeignKey(Perfil_Servico)
>
>
>
> ###
>   RELAÇÕES N -> 1  COM A TABELA PROJETOS  #
> ###
>
> # Para cada "PROJETO" eu tenho varios Header Enrichment #
> class Header_Enrich(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> s_url = models.URLField("Url")
> b_wap = models.BooleanField("Wap")
> b_web = models.BooleanField("Web")
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> # Para cada "PROJETO" eu tenho varias estimativas de trafego/receita
> para cada mes do ano. #
> class Traf_Receita(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> i_mes = models.IntegerField("Mês")
> i_ano = models.IntegerField("Ano")
> i_trafego = models.IntegerField("Trafego")
> i_receita = models.IntegerField("Receita")
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> # Para cada "PROJETO" eu tenho varias tarifas e descrições. #
> class Tarifar_Proj(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> i_tarifa_proj = models.IntegerField("Tarifa")
> s_desc_tarifa = models.CharField("Descrição da tarifa",
> max_length=200)
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> # Para cada "PROJETO" eu tenho varios planejamentos de midia. #
> class Planej_Midia(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FIELDS
> s_planej_midea = models.CharField("Planejamento de midia",
> max_length=200)
> s_desc_midea = models.CharField("Descrição", max_length=200)
> #FOREIGN KEY "Projetos"
> i_id_projetos = models.ForeignKey(Projetos)
>
> ###
> ###  TABELAS FATO   ###
> ###
>
> """
> # Relaciona Projeto com Tipo de Servico
> class Rel_Proj_Tipo_Servico(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FOREIGN KEY "Projetos" && "Motivo_Oferta"
> i_id_projetos = models.ForeignKey(Projetos)
> i_id_tipo_servico = models.ForeignKey(Tipo_Servico)
> """
>
> # Relaciona Projeto com motivo da oferta
> class Rel_Proj_Motivo(models.Model):
> #PRIMARY KEY
> i_id = models.AutoField(primary_key=True)
> #FOREIGN KEY "Projetos" && "Motivo_Oferta"
> i_id_projetos = models.ForeignKey(Projetos)
> i_id_motivo_oferta = models.ForeignKey(Motivo_Oferta)
>
> ###
> #

Re: Noob question

2012-08-02 Thread Kurtis Mullins
Syntax looks good -- but I didn't look at it too closely or try to execute
it. Run it and see if it complains :) (python manage.py sqlall)

I would recommend dropping your explicit primary keys. These are generated
automatically by Django.

On Thu, Aug 2, 2012 at 10:27 AM, Demian Brecht wrote:

> What, exactly are you confused about? What is your question?
>
> 2012/8/2 Robert 
>
>> Hi all, I´ve developed that model, but i´m quite confused about the
>> sintax, looks a bit freaky... Hers my code:
>>
>> from django.db import models
>>
>> ##
>>  PROJETOS 
>> ##
>>
>> class Projetos(models.Model):
>>
>> #PRIMARY KEY
>> i_id = models.AutoField(primary_key=True)
>>
>> #FIELDS
>> i_motivo_oferta = models.IntegerField()
>> s_nome_projeto = models.CharField("Projeto",max_length=100)
>> s_integrador = models.CharField("Integrador",max_length=100)
>> s_contend_provider = models.CharField("Contend
>> Provider",max_length=100)
>> s_marca_servico = models.CharField("Marca do
>> Serviço",max_length=100)
>>
>> ABRANGENCIA = (('R', 'Regional'),('N', 'Nacional'),)
>> s_abrangencia = models.CharField("Abrangência",max_length=2,
>> choices=ABRANGENCIA)
>>
>> TIPO_SERVICO = (('C', 'Cross'),('W', 'White Label'),)
>> i_id_tipo_servico =  models.CharField("Tipo de
>> Serviço",max_length=2, choices=TIPO_SERVICO)
>>
>> i_valor_retry = models.IntegerField("Valor de retry")
>> i_la =  models.IntegerField("Large account")
>> d_lanc_comercial = models.DateField("Lançamento comercial")
>> d_term_projeto = models.DateField("Término do projeto")
>>
>> ???
>> ??? PLANOS_DE_MIDIA = (('I', 'Internet'), ('T', 'TV'), ('R',
>> 'Radio'), ('R', 'Revista'), ('R', 'Midia Exterior'), ('R', 'Outros'),)
>> ??? i_plan_midia = models.CharField("Plano de
>> midia",max_length=2, choices=PLANOS_DE_MIDIA)
>> ???
>>
>> d_data_acordo = models.DateField("Data de Acordo")
>> d_data_revisao = models.DateField("Data de Revisão")
>> i_ura_id =  models.IntegerField("URA ID")
>> s_ura_desc = models.CharField("Descição URA",max_length=200)
>>
>> #FOREIGN KEY "Perfil_Servico"
>> i_id_perfil_servico = models.ForeignKey(Perfil_Servico)
>>
>>
>>
>> ###
>>   RELAÇÕES N -> 1  COM A TABELA PROJETOS  #
>> ###
>>
>> # Para cada "PROJETO" eu tenho varios Header Enrichment #
>> class Header_Enrich(models.Model):
>> #PRIMARY KEY
>> i_id = models.AutoField(primary_key=True)
>> #FIELDS
>> s_url = models.URLField("Url")
>> b_wap = models.BooleanField("Wap")
>> b_web = models.BooleanField("Web")
>> #FOREIGN KEY "Projetos"
>> i_id_projetos = models.ForeignKey(Projetos)
>>
>> # Para cada "PROJETO" eu tenho varias estimativas de trafego/receita
>> para cada mes do ano. #
>> class Traf_Receita(models.Model):
>> #PRIMARY KEY
>> i_id = models.AutoField(primary_key=True)
>> #FIELDS
>> i_mes = models.IntegerField("Mês")
>> i_ano = models.IntegerField("Ano")
>> i_trafego = models.IntegerField("Trafego")
>> i_receita = models.IntegerField("Receita")
>> #FOREIGN KEY "Projetos"
>> i_id_projetos = models.ForeignKey(Projetos)
>>
>> # Para cada "PROJETO" eu tenho varias tarifas e descrições. #
>> class Tarifar_Proj(models.Model):
>> #PRIMARY KEY
>> i_id = models.AutoField(primary_key=True)
>> #FIELDS
>> i_tarifa_proj = models.IntegerField("Tarifa")
>> s_desc_tarifa = models.CharField("Descrição da tarifa",
>> max_length=200)
>> #FOREIGN KEY "Projetos"
>> i_id_projetos = models.ForeignKey(Projetos)
>>
>> # Para cada "PROJETO" eu tenho varios planejamentos de midia. #
>> class Planej_Midia(models.Model):
>> #PRIMARY KEY
>> i_id = models.AutoField(primary_key=True)
>> #FIELDS
>> s_planej_midea = models.CharField("Planejamento de midia",
>> max_length=200)
>> s_desc_midea = models.CharField("Descrição", max_length=200)
>> #FOREIGN KEY "Projetos"
>> i_id_projetos = models.ForeignKey(Projetos)
>>
>> ###
>> ###  TABELAS FATO   ###
>> ###
>>
>> """
>> # Relaciona Projeto com Tipo de Servico
>> class Rel_Proj_Tipo_Servico(models.Model):
>> #PRIMARY KEY
>> i_id = models.AutoField(primary_key=True)
>> #FOREIGN KEY "Projetos" && "Motivo_Oferta"
>> i_id_projetos = models.ForeignKey(Projetos)
>> i_id_tipo_servico = models.ForeignKey(Tipo_Servico

Re: Noob question

2012-08-02 Thread Tomas Neme
as Kurtis says, drop the explicit Primary Keys, and drop the hungarian
notation as well (don't declare the variable type on it's name): I
don't need to be reminded that the name of a project will be a string,
it's pretty obvious. Also, python standards talk against using
underscore in class names, so standard naming would be HeaderEnrich
instead of Header_Enrich. Underscores for field names are good. I'd
also use less abbreviations.

also, I'd name the FK on that model just "projeto", since what you'll
get when you do `headerenrichobject.projeto` will be a Projeto object,
not it's ID

Try to forget the underlying database, the ORM is there to abstract you from it.

But all these are style things, the syntax looks good, so it's all
your call, but getting used to standardized style will make your life
easier, as well as the life of people who try to help you in mailing
lists and IRC channels

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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: Noob question

2012-08-02 Thread Roberto Ferreira Junior
Thanks guys for all replies, an especial thanks to Kurtis, I followed all
your tips and my code looks very clean and objective, agree to leave the
underscore from classes name! Although I really appreciate hungarian
notation, without them my vars is so much objective! :)

Cheers

On Thu, Aug 2, 2012 at 3:34 PM, Tomas Neme  wrote:

> as Kurtis says, drop the explicit Primary Keys, and drop the hungarian
> notation as well (don't declare the variable type on it's name): I
> don't need to be reminded that the name of a project will be a string,
> it's pretty obvious. Also, python standards talk against using
> underscore in class names, so standard naming would be HeaderEnrich
> instead of Header_Enrich. Underscores for field names are good. I'd
> also use less abbreviations.
>
> also, I'd name the FK on that model just "projeto", since what you'll
> get when you do `headerenrichobject.projeto` will be a Projeto object,
> not it's ID
>
> Try to forget the underlying database, the ORM is there to abstract you
> from it.
>
> But all these are style things, the syntax looks good, so it's all
> your call, but getting used to standardized style will make your life
> easier, as well as the life of people who try to help you in mailing
> lists and IRC channels
>
> --
> "The whole of Japan is pure invention. There is no such country, there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
> --
> 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.
>
>


-- 
--
Roberto Ferreira Junior
+5511-98009942
robefe...@gmail.com

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



Re: Noob Question

2007-11-16 Thread Karen Tracey

You need to create your own 500.html template.  It may not be listed
in the install/setup but it is mentioned in the full docs:

http://www.djangoproject.com/documentation/0.96/request_response/#the-500-server-error-view

If you're just starting out, though, I'd recommend getting up and
running with the DEBUG value in settings.py set to True.  It's not
something you want on in production but for initial setup and
development it is invaluable and much more informative than what
you'll get with a 500 server error page.

Karen

On Nov 16, 2007 12:44 AM, bdixon <[EMAIL PROTECTED]> wrote:
>
> Sorry for what is probably a pretty basic issue but after installing
> Django (.96.1) on my MacBook Pro I am getting an odd error that is
> telling me that template 500.html is not available.  There's nothing
> in the documentation (for installation / setup) on this so I have a
> feeling that it may be a Mac specific kind of thing.  I have seen
> others had this but there does not seem to be a clear cut solution.
> Any suggestions?
>
> Traceback (most recent call last):
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/servers/basehttp.py", line 272, in
> run
> self.result = application(self.environ, self.start_response)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/servers/basehttp.py", line 614, in
> __call__
> return self.application(environ, start_response)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/handlers/wsgi.py", line 189, in
> __call__
> response = self.get_response(request)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/handlers/base.py", line 126, in
> get_response
> return callback(request, **param_dict)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/views/defaults.py", line 88, in
> server_error
> t = loader.get_template(template_name) # You need to create a
> 500.html template.
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/template/loader.py", line 79, in
> get_template
> source, origin = find_template_source(template_name)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/template/loader.py", line 72, in
> find_template_source
> raise TemplateDoesNotExist, name
>
> TemplateDoesNotExist: 500.html
>
>
> Thanks so much,
> Brooke

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob Question

2007-11-16 Thread Kenneth Gonsalves


On 16-Nov-07, at 11:14 AM, bdixon wrote:

>  t = loader.get_template(template_name) # You need to create a
> 500.html template.

it is not mac specific, look at the line above

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: noob question about URLconf

2010-10-09 Thread Andi Trînculescu
You probably didn't run manage.py runserver.
You also need to install your app in settings.py

On Oct 9, 12:50 am, lyrical  wrote:
> I'm following the Django book but run into a pathing problem (I think)
> I did exactly what the book said, even copying and pasting the code as
> to make sure I didn't make a typo.
>
> so in the views.py I have
>
> from django.http import HttpResponse
>
> def hello(request):
> return HttpResponse("Hello world")
>
> and url I have
>
> from django.conf.urls.defaults import *
> from mysite.views import hello
>
> urlpatterns = patterns('',
> ('^hello/$', hello),
> )
>
> I get the error "Unable to connect" what is wrong?

-- 
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: noob question about URLconf

2010-10-09 Thread Andi Trînculescu
it looks like your dev server isn't running.

On Oct 9, 12:50 am, lyrical  wrote:
> I'm following the Django book but run into a pathing problem (I think)
> I did exactly what the book said, even copying and pasting the code as
> to make sure I didn't make a typo.
>
> so in the views.py I have
>
> from django.http import HttpResponse
>
> def hello(request):
> return HttpResponse("Hello world")
>
> and url I have
>
> from django.conf.urls.defaults import *
> from mysite.views import hello
>
> urlpatterns = patterns('',
> ('^hello/$', hello),
> )
>
> I get the error "Unable to connect" what is wrong?

-- 
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: noob question about URLconf

2010-10-09 Thread lyrical
Thanks, I indeed did not run my manage.py file.

On Oct 9, 5:35 am, Andi Trînculescu  wrote:
> You probably didn't run manage.py runserver.
> You also need to install your app in settings.py
>
> On Oct 9, 12:50 am, lyrical  wrote:
>
> > I'm following the Django book but run into a pathing problem (I think)
> > I did exactly what the book said, even copying and pasting the code as
> > to make sure I didn't make a typo.
>
> > so in the views.py I have
>
> > from django.http import HttpResponse
>
> > def hello(request):
> > return HttpResponse("Hello world")
>
> > and url I have
>
> > from django.conf.urls.defaults import *
> > from mysite.views import hello
>
> > urlpatterns = patterns('',
> > ('^hello/$', hello),
> > )
>
> > I get the error "Unable to connect" what is wrong?

-- 
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: Noob question about javascript files

2007-05-03 Thread theju

Since Javascript is a static file you have to define your js directory
in your urls.py. I've used a lot of Javascript Libraries and all have
worked successfully.

First in urls.py

(r'^js/(?P.*)$', 'django.views.static.serve', {'document_root':
'/media/agora/js/lib/MochiKit/'}),

And then in your templates



It's going to work.

-Thejaswi Puthraya
http://thejuhyd.blogspot.com


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



Re: Noob question about javascript files

2007-05-04 Thread Haku

OK, this works great!

Thank you very much!!!

On 4 Mag, 04:34, theju <[EMAIL PROTECTED]> wrote:
> Since Javascript is a static file you have to define your js directory
> in your urls.py. I've used a lot of Javascript Libraries and all have
> worked successfully.
>
> First in urls.py
>
> (r'^js/(?P.*)$', 'django.views.static.serve', {'document_root':
> '/media/agora/js/lib/MochiKit/'}),
>
> And then in your templates
>
> 
>
> It's going to work.
>
> -Thejaswi Puthrayahttp://thejuhyd.blogspot.com


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



Re: noob question - Feedparser / Template_Utils / time filters

2007-12-23 Thread James Bennett

On Dec 23, 2007 10:19 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> That all works - (renders as Fri, 21 Dec 2007 21:22:49 + ) but I
> can not apply any Django time filters (date, timesince, naturalday) to
> the {{entry.date }} variable. I would guess it is not recognizing the
> date as a 'date' but i can not find in the docs how to work this.


You'll be wanting to check out the feedparser documentation[1] to find
out what the attributes mean; in this case, for example, the 'date'
attribute is the actual literal string which appeared inside the feed,
and so logically can't be reformatted using date operations because
it's not a date object. You probably want the 'date_parsed' attribute
instead, which returns a tuple suitable for constructing various type
of date and time objects.


[1] http://feedparser.org/docs/


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: noob question - Feedparser / Template_Utils / time filters

2007-12-23 Thread [EMAIL PROTECTED]

James -

Thanks, I had worked through the date_parsed items - but was getting
the same error. Maybe I was missing some other piece at that point. i
will give it another shot.

Using modified_parsed gave me this date (2007, 12, 21, 21, 22, 49, 4,
355, 0)  but threw an error when applying a filter: AttributeError
at / 'time.struct_time' object has no attribute 'year'

I think I am just not familiar enough with Django's handling of
datetime to see what I am missing here.

Damon

On Dec 23, 11:34 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Dec 23, 2007 10:19 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > That all works - (renders as Fri, 21 Dec 2007 21:22:49 + ) but I
> > can not apply any Django time filters (date, timesince, naturalday) to
> > the {{entry.date }} variable. I would guess it is not recognizing the
> > date as a 'date' but i can not find in the docs how to work this.
>
> You'll be wanting to check out the feedparser documentation[1] to find
> out what the attributes mean; in this case, for example, the 'date'
> attribute is the actual literal string which appeared inside the feed,
> and so logically can't be reformatted using date operations because
> it's not a date object. You probably want the 'date_parsed' attribute
> instead, which returns a tuple suitable for constructing various type
> of date and time objects.
>
> [1]http://feedparser.org/docs/
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: noob question - Feedparser / Template_Utils / time filters

2007-12-23 Thread James Bennett

On Dec 23, 2007 11:06 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Using modified_parsed gave me this date (2007, 12, 21, 21, 22, 49, 4,
> 355, 0)  but threw an error when applying a filter: AttributeError
> at / 'time.struct_time' object has no attribute 'year'
>
> I think I am just not familiar enough with Django's handling of
> datetime to see what I am missing here.

This isn't a Django thing, it's a Python thing. Unless and until you
have something of type 'datetime.date' or 'datetime.datetime', you're
not going to be able to treat it like you do. The feed parser is
giving you a nine-element time tuple because that's a nice baseline
for a Python object representation -- you can feed it into all sorts
of other standard things to get other types of objects or do other
sorts of calculations. So go have a look at that tuple, and at the
docs for Python's standard 'datetime' and 'time' modules, and you
should get a feel for what you can do with it.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: noob question - Feedparser / Template_Utils / time filters

2007-12-23 Thread [EMAIL PROTECTED]

James thanks. I have been reviewing the Python docs but there are too
many moving parts for me at this point. I assume this can be
accomplished within the feeds.py module fairly simply but I am just
beginning to learn the code. I will give it a shot once I have a bit
more experience with it.

Damon

On Dec 23, 2:25 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Dec 23, 2007 11:06 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > Using modified_parsed gave me this date (2007, 12, 21, 21, 22, 49, 4,
> > 355, 0)  but threw an error when applying a filter: AttributeError
> > at / 'time.struct_time' object has no attribute 'year'
>
> > I think I am just not familiar enough with Django's handling of
> > datetime to see what I am missing here.
>
> This isn't a Django thing, it's a Python thing. Unless and until you
> have something of type 'datetime.date' or 'datetime.datetime', you're
> not going to be able to treat it like you do. The feed parser is
> giving you a nine-element time tuple because that's a nice baseline
> for a Python object representation -- you can feed it into all sorts
> of other standard things to get other types of objects or do other
> sorts of calculations. So go have a look at that tuple, and at the
> docs for Python's standard 'datetime' and 'time' modules, and you
> should get a feel for what you can do with it.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: noob question - Feedparser / Template_Utils / time filters

2007-12-23 Thread [EMAIL PROTECTED]

Gotta say - a week into this project - I am loving Django.

Wrote a small custom filter:

@register.filter ("fromdatetuple")
def fromdatetuple(value):
return datetime.datetime.fromtimestamp(time.mktime(value))
fromdatetuple.is_safe = True

And added this to the template:

{{ entry.date_parsed|fromdatetuple|timesince }} ago

And it returns:

"1 day, 22 hours ago"

On Dec 23, 3:38 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> James thanks. I have been reviewing the Python docs but there are too
> many moving parts for me at this point. I assume this can be
> accomplished within the feeds.py module fairly simply but I am just
> beginning to learn the code. I will give it a shot once I have a bit
> more experience with it.
>
> Damon
>
> On Dec 23, 2:25 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > On Dec 23, 2007 11:06 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > Using modified_parsed gave me this date (2007, 12, 21, 21, 22, 49, 4,
> > > 355, 0)  but threw an error when applying a filter: AttributeError
> > > at / 'time.struct_time' object has no attribute 'year'
>
> > > I think I am just not familiar enough with Django's handling of
> > > datetime to see what I am missing here.
>
> > This isn't a Django thing, it's a Python thing. Unless and until you
> > have something of type 'datetime.date' or 'datetime.datetime', you're
> > not going to be able to treat it like you do. The feed parser is
> > giving you a nine-element time tuple because that's a nice baseline
> > for a Python object representation -- you can feed it into all sorts
> > of other standard things to get other types of objects or do other
> > sorts of calculations. So go have a look at that tuple, and at the
> > docs for Python's standard 'datetime' and 'time' modules, and you
> > should get a feel for what you can do with it.
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> > correct.""
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question about model and view

2019-01-25 Thread Arturo Fernandez
The new form that I'm trying to make is the one with the variable: form, I 
forgot to mention that

On Friday, January 25, 2019 at 10:08:03 AM UTC-5, Arturo Fernandez wrote:
>
> Hello, I'm trying to make a simple form so I can dissect it and learn but 
> from the guide that I'm reading, they are doing it differently from what 
> I'm trying to accomplish. This are the two links:
>
> model.py: https://tutorial.djangogirls.org/en/django_models/
> view.py, forms.py: https://tutorial.djangogirls.org/en/django_forms/ 
>
> Just for the sake of learning I copied pasted those codes, now... she's 
> trying to create multiple pages in that tutorial, one for create and one 
> for edit but I only want to have 1 page which I have created, it's my 
> profile page, and there I want to edit it whether it's empty or not and 
> save it.
>
> If I do it like this in my view.py (which is where the error is happening):
>
>
> @login_required
> def profile(request):
> if request.method == 'POST':
> u_Passform = PasswordChangeForm(request.user, request.POST)
> u_form = UserUpdateForm(request.POST, instance=request.user)
> p_form = ProfileUpdateForm(request.POST,
> request.FILES,
> instance=request.user.profile)
>
>
> form = PostForm(request.POST, instance=post)
>
> if u_form.is_valid() and p_form.is_valid() and u_Passform.is_valid() and 
> form.is_valid():
> u_Passform.save()
> u_form.save()
> p_form.save()
>
> post = form.save(commit=False)
> post.author = request.user
> post.save()
>
> update_session_auth_hash(request, u_Passform)
> messages.success(request, f'Your account has been updated!')
>
> return redirect('profile')
>
> else:
> form = PostForm(instance=post)
> u_Passform = PasswordChangeForm(request.user)
> u_form = UserUpdateForm(instance=request.user)
> p_form = ProfileUpdateForm(instance=request.user.profile)
>
> context = {
> 'form': form,
> 'user_AddressForm': AddressForm,
> 'u_Passform': u_Passform,
> 'u_form': u_form,
> 'p_form': p_form
> }
>
> return render(request, 'users/profile.html', context)
>
>
> it says: UnboundLocalError: local variable 'post' referenced before 
> assignment
>
> the error I think that is basically on the form declaration right? how can 
> I get the data from the form? I created an admin section for it and I see 
> that the form data was saved there, but how can I display it on the view? 
> Note: the profile.html works fine, it's just the view.py the one with the 
> problem I think.
>
> Thanks guys
>
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c2258e02-798d-4778-84d3-db8686712506%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: noob question about part 2 of the tutorial

2009-08-10 Thread nostradamnit

It means you remove the line that says admin.site.register(Choice), as
the choices will be integrated in the Poll admin page now.



On Aug 10, 11:28 am, egrommet  wrote:
> I've just 
> reachedhttp://docs.djangoproject.com/en/1.0/intro/tutorial02/#adding-related...
> in the tutorial and am trying then to follow on.
>
> I've hit the par "Remove the register() call for the Choice model.
> Then, edit the Poll registration code to read:
> class ChoiceInline(admin.StackedInline):
>     model = Choice
>     extra = 3
>
> class PollAdmin(admin.ModelAdmin):
>     fieldsets = [
>         (None,               {'fields': ['question']}),
>         ('Date information', {'fields': ['pub_date'], 'classes':
> ['collapse']}),
>     ]
>     inlines = [ChoiceInline]
>
> admin.site.register(Poll, PollAdmin)"
>
> But I'm lost, not quite sure what remove the register() call means and
> when I try deleting that line the whole thing goes pear shaped.
> Anybody got an example of what the polls admin.py file should look
> like?
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: noob question about part 2 of the tutorial

2009-08-13 Thread egrommet

Star! Thanks for that, I'd tried doing it and failed - but wasn't sure
where it was going wrong.

Have done it now and am moving onwards.
Cheers

On Aug 10, 11:17 am, nostradamnit  wrote:
> It means you remove the line that says admin.site.register(Choice), as
> the choices will be integrated in the Poll admin page now.
>
> On Aug 10, 11:28 am, egrommet  wrote:
>
> > I've just 
> > reachedhttp://docs.djangoproject.com/en/1.0/intro/tutorial02/#adding-related...
> > in the tutorial and am trying then to follow on.
>
> > I've hit the par "Remove the register() call for the Choice model.
> > Then, edit the Poll registration code to read:
> > class ChoiceInline(admin.StackedInline):
> >     model = Choice
> >     extra = 3
>
> > class PollAdmin(admin.ModelAdmin):
> >     fieldsets = [
> >         (None,               {'fields': ['question']}),
> >         ('Date information', {'fields': ['pub_date'], 'classes':
> > ['collapse']}),
> >     ]
> >     inlines = [ChoiceInline]
>
> > admin.site.register(Poll, PollAdmin)"
>
> > But I'm lost, not quite sure what remove the register() call means and
> > when I try deleting that line the whole thing goes pear shaped.
> > Anybody got an example of what the polls admin.py file should look
> > like?
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> Is this possible? I am sure it is... Any tips ya'll could send my way
> would be spectacular!

Hrmm, forloop.counter. It is one of those days. :P

-- 
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: Noob question: Templates: How to count for loop?

2010-02-15 Thread rebus_
On 16 February 2010 02:52, mhulse  wrote:
>> Is this possible? I am sure it is... Any tips ya'll could send my way
>> would be spectacular!
>
> Hrmm, forloop.counter. It is one of those days. :P
>
> --
> 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.
>
>

Check out "cycle"  template tag too.

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#cycle

-- 
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: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> Hrmm, forloop.counter. It is one of those days. :P

But, how can I tell if it is every third item?

Also, is there a way to check if the current number is even?

In a PHP template, I might do this:

... forloop ...

... endforloop ...

Sorry if silly question.

Thanks!
M

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> Check out "cycle"  template tag too.
> http://docs.djangoproject.com/en/dev/ref/templates/builtins/#cycle

Thanks rebus_! I have played with that just a little bit. I will
explore it further.

Cheers,
Micky

-- 
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: Noob question: Templates: How to count for loop?

2010-02-15 Thread rebus_
On 16 February 2010 02:58, mhulse  wrote:
>> Hrmm, forloop.counter. It is one of those days. :P
>
> But, how can I tell if it is every third item?
>
> Also, is there a way to check if the current number is even?
>
> In a PHP template, I might do this:
>
> ... forloop ...
> 
> ... endforloop ...
>
> Sorry if silly question.
>
> Thanks!
> M
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.
>
>

{% for photo in photos %}

stuff
{% endfor %}

You could do it like this. There was a discussion recently about mod
operator and what happens when you want to do something every N times
but can't find it now for some reason :(

-- 
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: Noob question: Templates: How to count for loop?

2010-02-15 Thread rebus_
On 16 February 2010 02:58, mhulse  wrote:
>> Hrmm, forloop.counter. It is one of those days. :P
>
> But, how can I tell if it is every third item?
>
> Also, is there a way to check if the current number is even?
>
> In a PHP template, I might do this:
>
> ... forloop ...
> 
> ... endforloop ...
>
> Sorry if silly question.
>
> Thanks!
> M
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.
>
>

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#divisibleby
http://groups.google.com/group/django-developers/browse_thread/thread/20c309376c46590d?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: Noob question: Templates: How to count for loop?

2010-02-15 Thread mhulse
> You could do it like this. There was a discussion recently about mod
> operator and what happens when you want to do something every N times
> but can't find it now for some reason :(

Ah, interesting! Thanks for the code sample, I really appreciate your
assistance.

I will search around for the mod operator discussion... Sounds like it
could be a good read for me. :)

Thanks again!

Micky

-- 
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: Noob question: Templates: How to count for loop?

2010-02-16 Thread Daniel Roseman
On Feb 16, 2:12 am, mhulse  wrote:
> > You could do it like this. There was a discussion recently about mod
> > operator and what happens when you want to do something every N times
> > but can't find it now for some reason :(
>
> Ah, interesting! Thanks for the code sample, I really appreciate your
> assistance.
>
> I will search around for the mod operator discussion... Sounds like it
> could be a good read for me. :)
>
> Thanks again!
>
> Micky

There's also the built-in "divisibleby" filter, which is a bit like
mod:

{% if value|divisibleby:"6" %}

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



Re: Noob question: Templates: How to count for loop?

2010-02-16 Thread mhulse
Many thanks for the help rebus_ and Daniel! All of your suggestions,
code samples, and links have been extremely helpful.

I appreciate it.

Have a great day!

Cheers,
Micky

-- 
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: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread hutuworm

Since Python's a OS dependless language, and Django's based on Python,
so every popular Linux distro's suitable for Django developement.
Acctually I'm using RHEL, Fedora, Ubuntu as Django development
environment,  or you may want to check http://distrowatch.com/ .

hutuworm

On Dec 9, 10:57 pm, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> Hello,
>
> till now I've been experimenting with Django (development version)
> under Win2k. But Windows sucks. So I dare to make my first steps with
> Linux. Most of you will surely say I won't regret this decision ;-).
> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment. Well,
> I'm not even sure if there will be any great difference between
> several distributions regarding these aspects. Any comment is welcome.
>
> Regards,
> Andreas
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread Horst Gutmann

IMO the differences between the distributions out there shouldn't
really matter when it comes to GNU/Linux as a development environment.
You should always have the option to install whatever you want from
source. You might face some problems with some distros that use for
example very old version of whatever database system you want to use,
but again: Nothing that would completely keep you from developing
using Django.

That said, the more popular a distro, the more help you will get from
other people, so you should focus on the big ones like Ubuntu, Fedora
etc. :-)

- Horst

On Dec 9, 2007 3:57 PM, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> till now I've been experimenting with Django (development version)
> under Win2k. But Windows sucks. So I dare to make my first steps with
> Linux. Most of you will surely say I won't regret this decision ;-).
> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment. Well,
> I'm not even sure if there will be any great difference between
> several distributions regarding these aspects. Any comment is welcome.
>
> Regards,
> Andreas
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread Todd O'Bryan

If you decide to use Ubuntu, here's a link to how to set it up for
developing Django using PyDev on Eclipse. The steps have been tested
by several high school students, so they're fairly straightforward.
(That doesn't mean you won't find a problem, however.)

https://www.dupontmanual.org/wikis/spectops//HOWTO:_Install_Ubuntu_Linux/HOWTO%3A_Install_Ubuntu_Linux

There are some parts of the how-to you should skip, obviously. (Trying
to set up an account on our server, for one.)

HTH,
Todd

On Dec 9, 2007 10:14 AM, Horst Gutmann <[EMAIL PROTECTED]> wrote:
>
> IMO the differences between the distributions out there shouldn't
> really matter when it comes to GNU/Linux as a development environment.
> You should always have the option to install whatever you want from
> source. You might face some problems with some distros that use for
> example very old version of whatever database system you want to use,
> but again: Nothing that would completely keep you from developing
> using Django.
>
> That said, the more popular a distro, the more help you will get from
> other people, so you should focus on the big ones like Ubuntu, Fedora
> etc. :-)
>
> - Horst
>
>
> On Dec 9, 2007 3:57 PM, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> >
> > Hello,
> >
> > till now I've been experimenting with Django (development version)
> > under Win2k. But Windows sucks. So I dare to make my first steps with
> > Linux. Most of you will surely say I won't regret this decision ;-).
> > But since I haven't any experience with Linux yet, I want to choose a
> > distribution that is best suited for someone coming from the Windows-
> > world AND suited to establish a Django development environment. Well,
> > I'm not even sure if there will be any great difference between
> > several distributions regarding these aspects. Any comment is welcome.
> >
> > Regards,
> > Andreas
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread Jarek Śmiejczak

> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment.
As far as I know Fedora, Ubuntu and Suse have LiveCD .
I suggest to download ISO, burn ISO on dvd/cd, run, play(with all
download livecd's :) and then choose your development environment.

I'm currently working on Ubuntu/OpenSuse with Django and Gedit [part
of Gnome project](one of best simple editors that i ever seen - with
powerful snippet extension) and some kernel features such as FUSE(and
connected with this sshfs).
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread Kenneth Gonsalves


On 09-Dec-07, at 8:27 PM, Andreas Pfrengle wrote:

> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment.

mandriva

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread [EMAIL PROTECTED]

I'd strongly recommend Ubuntu. It's got the power and flexibility of
Debian with ease-of-use that is absolutely outstanding. It's a stable
server product, and performs very well on the desktop as well.

On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> Hello,
>
> till now I've been experimenting with Django (development version)
> under Win2k. But Windows sucks. So I dare to make my first steps with
> Linux. Most of you will surely say I won't regret this decision ;-).
> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment. Well,
> I'm not even sure if there will be any great difference between
> several distributions regarding these aspects. Any comment is welcome.
>
> Regards,
> Andreas
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-10 Thread kevinski

A little over a year ago, I was in your shoes. Microsoft just didn't
do it for me anymore, and I wasn't sure where to turn. A lot of people
here are recommending Ubuntu, but as an individual that was not too
long ago in your situation, and has quickly developed a decent
knowledge of Linux server administration, believe me when I say that
Ubuntu is the greatest distribution for a newbie.

First, the way packages are managed is so simple. Setting up a LAMP
server with Django will probably take you less than an hour.
Second, the online documentation is very thorough and easy to follow.
No matter what package you need to install, you will be able to find
simple, step by step instructions on how to configure it.
Third, a new book is coming out on Ubuntu Server Administration which
will work as an excellent compliment to the Django Book regarding the
administration of your server:
http://www.amazon.com/Beginning-Ubuntu-Server-Administration-Professional/dp/1590599233/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1197312353&sr=8-1

If you are interested, check out the following article. It is related
to setting up a Django/Ubuntu server on Slicehost, but really helped
me along when I was setting up my own box. I guarantee you it will
save you gobs of time.

http://www.inerciasensorial.com.br/2006/11/22/perils-of-software-development/django-on-slicehost-virtual-private-server/

I hope this info is helpful to you.


On Dec 9, 8:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> Hello,
>
> till now I've been experimenting with Django (development version)
> under Win2k. But Windows sucks. So I dare to make my first steps with
> Linux. Most of you will surely say I won't regret this decision ;-).
> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment. Well,
> I'm not even sure if there will be any great difference between
> several distributions regarding these aspects. Any comment is welcome.
>
> Regards,
> Andreas
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-11 Thread Andreas Pfrengle

Thanks for so many replies and the helpful links. Ubuntu really seems
to be a good solution as far as I can tell by now. I'll give it a try.
At least now I know what I will do on Christmas :-)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-11 Thread Ramdas S

Go for Ubuntu.

RS

On Dec 11, 5:48 pm, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> Thanks for so many replies and the helpful links. Ubuntu really seems
> to be a good solution as far as I can tell by now. I'll give it a try.
> At least now I know what I will do on Christmas :-)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-11 Thread Joe

To make things easy, you could download VMware Server - run that on
your windows box and install the prebuilt appliances. That'd make it
easy to try out a few linux versions. VMware is free as are the
appliances.

I use ubuntu primarily.

j

On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> Hello,
>
> till now I've been experimenting with Django (development version)
> under Win2k. But Windows sucks. So I dare to make my first steps with
> Linux. Most of you will surely say I won't regret this decision ;-).
> But since I haven't any experience with Linux yet, I want to choose a
> distribution that is best suited for someone coming from the Windows-
> world AND suited to establish a Django development environment. Well,
> I'm not even sure if there will be any great difference between
> several distributions regarding these aspects. Any comment is welcome.
>
> Regards,
> Andreas
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-11 Thread Lic. José M. Rodriguez Bacallao
I will recommend Arch, is simple and powerful.

On Dec 11, 2007 1:22 PM, Joe <[EMAIL PROTECTED]> wrote:
>
> To make things easy, you could download VMware Server - run that on
> your windows box and install the prebuilt appliances. That'd make it
> easy to try out a few linux versions. VMware is free as are the
> appliances.
>
> I use ubuntu primarily.
>
> j
>
>
> On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > till now I've been experimenting with Django (development version)
> > under Win2k. But Windows sucks. So I dare to make my first steps with
> > Linux. Most of you will surely say I won't regret this decision ;-).
> > But since I haven't any experience with Linux yet, I want to choose a
> > distribution that is best suited for someone coming from the Windows-
> > world AND suited to establish a Django development environment. Well,
> > I'm not even sure if there will be any great difference between
> > several distributions regarding these aspects. Any comment is welcome.
> >
> > Regards,
> > Andreas
> >
>



-- 
Lic. Jos� M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-11 Thread Aspersieman

Lic. José M. Rodriguez Bacallao wrote:
> I will recommend Arch, is simple and powerful.
>
> On Dec 11, 2007 1:22 PM, Joe <[EMAIL PROTECTED]> wrote:
>   
>> To make things easy, you could download VMware Server - run that on
>> your windows box and install the prebuilt appliances. That'd make it
>> easy to try out a few linux versions. VMware is free as are the
>> appliances.
>>
>> I use ubuntu primarily.
>>
>> j
>>
>>
>> On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
>> 
>>> Hello,
>>>
>>> till now I've been experimenting with Django (development version)
>>> under Win2k. But Windows sucks. So I dare to make my first steps with
>>> Linux. Most of you will surely say I won't regret this decision ;-).
>>> But since I haven't any experience with Linux yet, I want to choose a
>>> distribution that is best suited for someone coming from the Windows-
>>> world AND suited to establish a Django development environment. Well,
>>> I'm not even sure if there will be any great difference between
>>> several distributions regarding these aspects. Any comment is welcome.
>>>
>>> Regards,
>>> Andreas
>>>
>>>   
>
>
>
>   
I second the Arch suggestion - it's awesome!

-- 

The three things to remember about Llamas:
1) They are harmless
2) They are deadly
3) They are made of lava, and thus nice to cuddle.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-12 Thread Ben Ford
I third it... except for the fact that this is a newby asking. Given that
fact I'd have to say (k)ubuntu. Personally I love Arch!!
Ben

On 12/12/2007, Aspersieman <[EMAIL PROTECTED]> wrote:
>
>
> Lic. José M. Rodriguez Bacallao wrote:
> > I will recommend Arch, is simple and powerful.
> >
> > On Dec 11, 2007 1:22 PM, Joe <[EMAIL PROTECTED]> wrote:
> >
> >> To make things easy, you could download VMware Server - run that on
> >> your windows box and install the prebuilt appliances. That'd make it
> >> easy to try out a few linux versions. VMware is free as are the
> >> appliances.
> >>
> >> I use ubuntu primarily.
> >>
> >> j
> >>
> >>
> >> On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
> >>
> >>> Hello,
> >>>
> >>> till now I've been experimenting with Django (development version)
> >>> under Win2k. But Windows sucks. So I dare to make my first steps with
> >>> Linux. Most of you will surely say I won't regret this decision ;-).
> >>> But since I haven't any experience with Linux yet, I want to choose a
> >>> distribution that is best suited for someone coming from the Windows-
> >>> world AND suited to establish a Django development environment. Well,
> >>> I'm not even sure if there will be any great difference between
> >>> several distributions regarding these aspects. Any comment is welcome.
> >>>
> >>> Regards,
> >>> Andreas
> >>>
> >>>
> >
> >
> >
> >
> I second the Arch suggestion - it's awesome!
>
> --
>
> The three things to remember about Llamas:
> 1) They are harmless
> 2) They are deadly
> 3) They are made of lava, and thus nice to cuddle.
>
>
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+6281317958862

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-12 Thread Andreas Pfrengle

VMware seems to be a good idea - but I'll probably install win2k again
from Ubuntu as main system ;-) My win-machine has gotten so bloated
and slow that it is anyways time for a new installation. That's the
reason why I wanted a new system at all.

Arch also looks lean and fast, but the docs for Ubuntu are a big plus
to me.

Regards,
Andreas

On Dec 11, 7:22 pm, Joe <[EMAIL PROTECTED]> wrote:
> To make things easy, you could download VMware Server - run that on
> your windows box and install the prebuilt appliances. That'd make it
> easy to try out a few linux versions. VMware is free as are the
> appliances.
>
> I use ubuntu primarily.
>
> j
>
> On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > till now I've been experimenting with Django (development version)
> > under Win2k. But Windows sucks. So I dare to make my first steps with
> > Linux. Most of you will surely say I won't regret this decision ;-).
> > But since I haven't any experience with Linux yet, I want to choose a
> > distribution that is best suited for someone coming from the Windows-
> > world AND suited to establish a Django development environment. Well,
> > I'm not even sure if there will be any great difference between
> > several distributions regarding these aspects. Any comment is welcome.
>
> > Regards,
> > Andreas
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-12 Thread eXt

VMWare is a very good suggestion. Another option is to use VirtualBox
which is also free.

On 11 Gru, 19:22, Joe <[EMAIL PROTECTED]> wrote:
> To make things easy, you could download VMware Server - run that on
> your windows box and install the prebuilt appliances. That'd make it
> easy to try out a few linux versions. VMware is free as are the
> appliances.
>
> I use ubuntu primarily.
>
> j
>
> On Dec 9, 9:57 am, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > till now I've been experimenting with Django (development version)
> > under Win2k. But Windows sucks. So I dare to make my first steps with
> > Linux. Most of you will surely say I won't regret this decision ;-).
> > But since I haven't any experience with Linux yet, I want to choose a
> > distribution that is best suited for someone coming from the Windows-
> > world AND suited to establish a Django development environment. Well,
> > I'm not even sure if there will be any great difference between
> > several distributions regarding these aspects. Any comment is welcome.
>
> > Regards,
> > Andreas
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob question: using multiple classes in a detail page's view

2010-12-21 Thread Mário Neto
For that you could use the method select_related, if you want the details
page has executives related to the nonprofit:

e = Executive.objects.select_related().get(pk=id)

Thus, there is a performance gain, it does not require database queries.

2010/12/21 Matt 

> I have two classes in my model: nonprofit and executive. It's a one-to-
> many relationship, multiple executives for each nonprofit.
> I created an index page that displays all executives and all
> nonprofits. I've created detail pages for nonprofit and executive.
> But when I try to link back to a nonprofit page on the executive
> detail page, I get weird results and I'm not sure why.
>
> With the view file and template below, my index page stops properly
> linking to all the executives. It stops after the number of nonprofits
> in the database.
> And the executive detail template is still ignoring the nonprofit
> call. What am I missing?
>
> View:
> from django.shortcuts import render_to_response, get_object_or_404
> from nonprofit.models import executive, nonprofit
>
> def index(request):
>nonprofits = nonprofit.objects.all()
>executives = executive.objects.all()
>dictionaries = {'nonprofits': nonprofits, 'executives': executives}
>return render_to_response('nonprofit/index.html', dictionaries)
>
> def detail(request, id):
>n = get_object_or_404(nonprofit, pk=id)
>dictionaries = {'nonprofit': n}
>return render_to_response('nonprofit/detail.html', dictionaries)
>
> def executive_index(request):
>executives = executive.objects.all()
>return render_to_response('nonprofit/executive_index.html',
> {'executives': executives})
>
> def executive_detail(request,id):
>e = get_object_or_404(executive, pk=id)
>n = get_object_or_404(nonprofit, pk=id)
>dictionaries = {'executive': e, 'nonprofit': n}
>return render_to_response('nonprofit/executive_detail.html',
> dictionaries)
>
>
> template:
> {% load humanize %}
> {{ executive.name }}
> 
> Organization: 
> {{ executive.nonprofit }}
> Title: {{ executive.title }}
> Salary: ${{ executive.salary|intcomma }}
>
>
>
>
>
> --
> 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.
>
>


-- 
Att. Mário A. Chaves Neto
Designer / U.I. Engineer
MBA - Design Digital

-- 
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: Noob question: using multiple classes in a detail page's view

2010-12-21 Thread Matt
Swapping out the get_object_or_404 mess with the select_related method
works in some sense in that my executive detail pages show up properly
but the template is still ignoring the information from the nonprofit
class.

I'm expecting that a click on that href would result in /nonprofit/1
but instead it's just giving me /nonprofit.



On Dec 21, 3:07 pm, Mário Neto  wrote:
> For that you could use the method select_related, if you want the details
> page has executives related to the nonprofit:
>
> e = Executive.objects.select_related().get(pk=id)
>
> Thus, there is a performance gain, it does not require database queries.
>
> 2010/12/21 Matt 
>
>
>
>
>
>
>
>
>
> > I have two classes in my model: nonprofit and executive. It's a one-to-
> > many relationship, multiple executives for each nonprofit.
> > I created an index page that displays all executives and all
> > nonprofits. I've created detail pages for nonprofit and executive.
> > But when I try to link back to a nonprofit page on the executive
> > detail page, I get weird results and I'm not sure why.
>
> > With the view file and template below, my index page stops properly
> > linking to all the executives. It stops after the number of nonprofits
> > in the database.
> > And the executive detail template is still ignoring the nonprofit
> > call. What am I missing?
>
> > View:
> > from django.shortcuts import render_to_response, get_object_or_404
> > from nonprofit.models import executive, nonprofit
>
> > def index(request):
> >        nonprofits = nonprofit.objects.all()
> >        executives = executive.objects.all()
> >        dictionaries = {'nonprofits': nonprofits, 'executives': executives}
> >        return render_to_response('nonprofit/index.html', dictionaries)
>
> > def detail(request, id):
> >        n = get_object_or_404(nonprofit, pk=id)
> >        dictionaries = {'nonprofit': n}
> >        return render_to_response('nonprofit/detail.html', dictionaries)
>
> > def executive_index(request):
> >    executives = executive.objects.all()
> >    return render_to_response('nonprofit/executive_index.html',
> > {'executives': executives})
>
> > def executive_detail(request,id):
> >        e = get_object_or_404(executive, pk=id)
> >        n = get_object_or_404(nonprofit, pk=id)
> >        dictionaries = {'executive': e, 'nonprofit': n}
> >        return render_to_response('nonprofit/executive_detail.html',
> > dictionaries)
>
> > template:
> > {% load humanize %}
> > {{ executive.name }}
> > 
> > Organization: 
> > {{ executive.nonprofit }}
> > Title: {{ executive.title }}
> > Salary: ${{ executive.salary|intcomma }}
>
> > --
> > 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 > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Att. Mário A. Chaves Neto
> Designer / U.I. Engineer
> MBA - Design Digital

-- 
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: Noob question: Is the User model compatible with subscription-style website?

2018-02-15 Thread Etienne Robillard



Le 2018-02-15 à 01:17, Tom Tanner a écrit :
I'm working on a Django-powered subscription website with a 
Django-powered CMS backend. Can the User model, or a derived class, be 
made to be compatible with this idea? In my case, I want to store a 
user's username, password, and subscription ID.

Yes.


--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da4f96f9-95cd-4b23-b4d2-842ef3649226%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f774e048-7889-d2fe-5623-e545ad4b6ac7%40yandex.com.
For more options, visit https://groups.google.com/d/optout.