Re: Trailing zeros in DecimalField

2013-05-20 Thread Derek
Possibly related to localisation.  See:

https://groups.google.com/forum/?fromgroups#!topic/django-users/evJ7jg-YhdM
https://docs.djangoproject.com/en/dev/topics/i18n/formatting/

On Sunday, 19 May 2013 01:37:22 UTC+2, Pedro J. Aramburu wrote:
>
> I've been reviewing the code of *models.DecimalField* and *
> forms.DecimalField* because trailing zeros after the decimal point are 
> being removed in my forms. I didn't find anything suggesting that it's done 
> there, instead they are handled properly according to my needs. Although 
> the proper handling, on the django admin site forms the trailing zeros are 
> being removed. 
>
> Does anyone knows how to "fix" it? Is this a django-admin thing or have I 
> missed something?
>
> I would appreciate any insight.
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django setting.py issue

2013-05-20 Thread husw
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 
'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'data.db',  # Or path to database file 
if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for 
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for default. 
Not used with sqlite3.
}
}

On Monday, May 20, 2013 2:14:41 PM UTC+8, Sun Simon wrote:
>
> *Basic Facts:*
> OS: Windows  
> Python version: 2.7
> Django Version: Instant Django(
> https://groups.google.com/forum/?fromgroups#!topic/django-users/WLA0ziqbwpg) 
> . 
>
> I have Django installed using Instant Django and everything is fine until 
> I beging to fiddle with database settings. Here is what my setting.py looks 
> like:
>
>
> 
>
>
>
>
>
>
> And when I type in python manage.py syncdb in cmd and here is what I get:
>
>
> 
>
>
>
>
>
>
>
>
>
>
> What is wrong here and can someone help with this?
>
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Bulk] Re: Template Inheritance doubt

2013-05-20 Thread Dow Street
Hi.  I'm not sure, but we may be using the terms 'parent' and 'child' 
differently (i.e. what you're calling a child I'm calling a parent?).  I have 
only used django template inheritance where a given template file has at most 
one {% extends %} tag in it - that is what I am referring to when I say 'has at 
most one parent'.  However, the base.html template (the parent) is extended by 
many different child templates (e.g. view1.html).  Is this what you are 
thinking as well?

If you want a template to inherit from multiple parents - e.g. include multiple 
{% extends %} tags - well, that is not something I have done previously (and I 
can't say whether that model is supported).  However, you can achieve 
comparable functionality (I think) by adding a layer in the inheritance 
hierarchy - for example:

base.html - has empty blocks for topbar and sidebar
topbar.html - extends base.html and contains the code for the topbar  
sidebar.html - extends topbar.html and contains the code for the sidebar
view1.html - extends sidebar.html and contains the code specific to that page

If you load the view1.html template in your view function all those {% extends 
%} tags will cause the django template engine to walk the hierarchy, starting 
from base -> topbar -> sidebar -> view1, leaving you with a single 'merged' 
html file.  At each step, if a child template has a block with the same name as 
one of the parents, the child block will overwrite the contents of the parent 
block.  Does this make sense?

(and I should note that I am by no means an expert in the django template 
processor - this is just my understanding).

R,
Dow


On May 18, 2013, at 11:12 PM, Parin Porecha  wrote:

> Dow,
> I am trying to have multiple children of the same parent. And thats why I'm 
> not able to decide which child to load. Anyways, the sidebar and topbar are 
> more or less static, so I guess there isn't much need to have separate files 
> for them. I want to have them different so that developing that section of 
> the website would be easier. In the end, I want to merge all those different 
> sections into one file and load that in my view. Can you please help me with 
> this ?
> 
> Artem,
> Yes, I get it :) Thanks!
> 
> 
> On Sat, May 18, 2013 at 9:56 PM, Artem Zinoviev  wrote:
> if you have base.html and sidebar.html, base.html file just declare {% block 
> sidebar %} section and sidebar.html make implementation of it, if you have 
> SidebarView, then you load sidebar.html and this file take all from {% 
> extends base.html %}. And if you try load base.html from SidebarView - you 
> get it :-), but {% block sidebar %} section be blank...
> 
> суббота, 18 мая 2013 г., 12:14:37 UTC+3 пользователь Parin Porecha написал:
> Hi,
> 
> I have just started to learn Django's template inheritance and I am stuck due 
> to this problem -
> In my application's 'base.html', I have defined two blocks -
> {% block topbar %}{% endblock topbar %}
> and
> {% block sidebar %}{% endblock sidebar %}
> 
> I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
> and 'topbar.html' which extends {% block topbar %}
> 
> The 'sidebar.html' is also divided into further blocks which are extended by 
> other templates.
> 
> Now, my question is -
> in 'views.py', i have a view which is supposed to render the whole homepage ( 
> i.e.- including the sidebar, topbar and content ). So, which template should 
> I load in the view, so that both sidebar and topbar plus the content defined 
> in other templates gets shown ?
> because 'base.html' contains many children, I'm confused which one to load
> 
> Thanks to mattmc who tried to help me with this in IRC. Sorry, didn't get it 
> completely :)
> 
> -- 
> Regards,
> Parin Porecha
> 
> say Kifflom! and look forward to 17.09.13 !
> 
> -- 
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 
> 
> 
> -- 
> Regards,
> Parin Porecha
> 
> say Kifflom! and look forward to 17.09.13 !
> 
> -- 
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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

Re: [Bulk] Re: Template Inheritance doubt

2013-05-20 Thread Parin Porecha
Dow,
I am using the chained approach which you suggested ( base -> topbar ->
sidebar -> view1 ). It works perfectly as i wanted :)

Thanks!


On Sun, May 19, 2013 at 10:50 PM, Dow Street  wrote:

> Hi.  I'm not sure, but we may be using the terms 'parent' and 'child'
> differently (i.e. what you're calling a child I'm calling a parent?).  I
> have only used django template inheritance where a given template file has
> at most one {% extends %} tag in it - that is what I am referring to when I
> say 'has at most one parent'.  However, the base.html template (the parent)
> is extended by many different child templates (e.g. view1.html).  Is this
> what you are thinking as well?
>
> If you want a template to inherit from multiple parents - e.g. include
> multiple {% extends %} tags - well, that is not something I have done
> previously (and I can't say whether that model is supported).  However, you
> can achieve comparable functionality (I think) by adding a layer in the
> inheritance hierarchy - for example:
>
> base.html - has empty blocks for topbar and sidebar
> topbar.html - extends base.html and contains the code for the topbar
> sidebar.html - extends topbar.html and contains the code for the sidebar
> view1.html - extends sidebar.html and contains the code specific to that
> page
>
> If you load the view1.html template in your view function all those {%
> extends %} tags will cause the django template engine to walk the
> hierarchy, starting from base -> topbar -> sidebar -> view1, leaving you
> with a single 'merged' html file.  At each step, if a child template has a
> block with the same name as one of the parents, the child block will
> overwrite the contents of the parent block.  Does this make sense?
>
> (and I should note that I am by no means an expert in the django template
> processor - this is just my understanding).
>
> R,
> Dow
>
>
> On May 18, 2013, at 11:12 PM, Parin Porecha 
> wrote:
>
> > Dow,
> > I am trying to have multiple children of the same parent. And thats why
> I'm not able to decide which child to load. Anyways, the sidebar and topbar
> are more or less static, so I guess there isn't much need to have separate
> files for them. I want to have them different so that developing that
> section of the website would be easier. In the end, I want to merge all
> those different sections into one file and load that in my view. Can you
> please help me with this ?
> >
> > Artem,
> > Yes, I get it :) Thanks!
> >
> >
> > On Sat, May 18, 2013 at 9:56 PM, Artem Zinoviev 
> wrote:
> > if you have base.html and sidebar.html, base.html file just declare {%
> block sidebar %} section and sidebar.html make implementation of it, if you
> have SidebarView, then you load sidebar.html and this file take all from {%
> extends base.html %}. And if you try load base.html from SidebarView - you
> get it :-), but {% block sidebar %} section be blank...
> >
> > суббота, 18 мая 2013 г., 12:14:37 UTC+3 пользователь Parin Porecha
> написал:
> > Hi,
> >
> > I have just started to learn Django's template inheritance and I am
> stuck due to this problem -
> > In my application's 'base.html', I have defined two blocks -
> > {% block topbar %}{% endblock topbar %}
> > and
> > {% block sidebar %}{% endblock sidebar %}
> >
> > I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
> > and 'topbar.html' which extends {% block topbar %}
> >
> > The 'sidebar.html' is also divided into further blocks which are
> extended by other templates.
> >
> > Now, my question is -
> > in 'views.py', i have a view which is supposed to render the whole
> homepage ( i.e.- including the sidebar, topbar and content ). So, which
> template should I load in the view, so that both sidebar and topbar plus
> the content defined in other templates gets shown ?
> > because 'base.html' contains many children, I'm confused which one to
> load
> >
> > Thanks to mattmc who tried to help me with this in IRC. Sorry, didn't
> get it completely :)
> >
> > --
> > Regards,
> > Parin Porecha
> >
> > say Kifflom! and look forward to 17.09.13 !
> >
> > --
> > 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 http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
> >
> >
> > --
> > Regards,
> > Parin Porecha
> >
> > say Kifflom! and look forward to 17.09.13 !
> >
> > --
> > 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 grou

Re: Raise field error in models clean method

2013-05-20 Thread Jani Tiainen
On Sun, 19 May 2013 06:38:50 -0700 (PDT)
Kai Schlamp  wrote:

> Hello.
> 
> How to raise a `ValidationException` in the models `clean` method?
> 
> def clean(self):
> from django.core.exceptions import ValidationError
> raise ValidationError({'title': 'not ok'})
> 
> The above does not add the error to the `title` field (when using a form), 
> but to the non field errors.
> 
> This is possible inside a form (`self._errors['title'] = 
> self.error_class([msg])`), but `self._errors` does not exist inside the 
> models `clean` method.
> 
> I know that clean normally is for non field errors, but there are cases 
> when only some kind of combination of values in separate fields are valid. 
> I want to directly associate the error with a field and let the user know 
> "if you change this field than everything passes".
> 
> Is it possible (even if not recommended)?

Well if you consider that error you describe is about combination of fields A 
and B how you can tell that which one is really incorrect? A or B? In most 
cases it's really impossible to tell the difference hence it's more natural to 
report that field combination didn't validated and some action must be done to 
correct the situation. 

So in example case end user has to change field A or field B or even both. 

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




djnago xml model specification?

2013-05-20 Thread Michał Nowotka
I'm using django with many related projects. All those projects are using 
their own models. But unfortunately this is not DRY, because each model 
differ from each other very slightly, for example some columns or tables 
from one model are missing in other, or some model defines custom save 
method while the other one does not. 

My idea was to define simple core model - the one that has all tables and 
columns and no custom methods.

Then I could dynamically create other models using code like this:



def createModelClass(modelClass):
dict = {}
for field in modelClass._meta.fields:
 if modelClass.__name__ not in EXCLUDED_FIELDS or field.name 
not in EXCLUDED_FIELDS[modelClass.__name__]:
dict[field.name] = field

dict["Meta"] = type('Meta', (ChemblCoreAbstractModel.Meta, object), 
{'unique_together': modelClass._meta.unique_together})
dict["__module__"] = mod.__name__

return type(modelClass.__name__, (CoreAbstractModel, ), dict)

#--

def getCoreModelClasses(module):
return  [x[1] for x in 
inspect.getmembers(sys.modules[module.__name__]) if
 inspect.isclass(x[1]) and issubclass(x[1], 
CoreAbstractModel) and x[1].__name__ not in EXCLUDED_MODELS]

Unfortunately I can't do this because fields remember their models 
(especially related fields). So in principle I would have to change the 
code to create new fields from scratch just reading attributes from the 
original model. 

This makes no sense: inspect model to create another model. In that case 
would be much better to create model from some XML specification that would 
be easier to read and modify and which is not bound to any particular 
django app. 

So my question is - is there any django plugin that allows to express model 
in terms of xml and then create app specific model from this xml?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How do I seo in my website?

2013-05-20 Thread frocco
Hello,

I notice that my site does not come up when searching in google.
What do I need to do in django to resolve this?

Thanks

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How do I seo in my website?

2013-05-20 Thread Rafael E. Ferrero
https://django-seo.readthedocs.org/en/latest/introduction/tutorial.html


2013/5/20 frocco 

> Hello,
>
> I notice that my site does not come up when searching in google.
> What do I need to do in django to resolve this?
>
> Thanks
>
> --
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Rafael E. Ferrero
Claro: (03562) 15514856

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get url parameters

2013-05-20 Thread Hélio Miranda
Hi

I need to get a parameter from the url which is the id and do not know how.
When my url is like this: *
http://localhost:8080/test/view/20519364e38774a71190edb28c*
I do: *url(r'^view/(?P\w+)', 'rest.views.view'),*
And everything ok.

Now I have a url like this: *
http://localhost:8080/test/view/*
that the error looks like this: *
http://localhost:8080/test/view/%3CGridFSProxy:%20519a3a6c8774a717dc59a84a%3E
*

With a url so, how can I get only the number (*20519a3a6c8774a717dc59a84a*)?
I'm trying this:
*url(r'^view/.*Proxy:%(?P\w+)%.*', 'rest.views.view'),*

But it is giving, anyone know what I'm doing wrong?
Someone can help me?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How do I seo in my website?

2013-05-20 Thread frocco
Thank you

On Monday, May 20, 2013 10:35:06 AM UTC-4, frocco wrote:
>
> Hello,
>
> I notice that my site does not come up when searching in google.
> What do I need to do in django to resolve this?
>
> Thanks
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Python/Django DevOps community and resources

2013-05-20 Thread Daniele Procida
Hi folks. I've just got back from the most astounding DjangoCon Europe in 
Warsaw, where several of decided that the DevOps in the community needed more 
mutual support.

So, we've set up #django-devops on irc.freenode.net, and 
 for an email list.

Do join us if this sort of thing is your concern.

Daniele

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django Form Widget for JSON

2013-05-20 Thread Александр Аббасов
Good day for all,
I want to share with community a solution that I hadn't few days ago.
My task have been to split a JSON data by a fileds of a form, edit data at 
the fields and save to the JSON. I could apply a few solutions but they are 
don't work with nested the JSON data.

Finally, I decided myself. Here my a free solution 
https://github.com/abbasovalex/django-SplitJSONWidget-form

With hope it will resolve a similar tasks.

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Inserting a search field into tabularline

2013-05-20 Thread Victor

As a newby I started an app that works quite fine. Here are the models (Forgive 
some 'slip of the tongue' but I had to translate my *.py's into English and 
simplify them):

In models.py
.
.
class Item(models.Model):
id = models.AutoField(primary_key=True)
barcode = models.CharField(max_length=30, unique=True, db_index=True) # 
Field name made lowercase.
description = models.CharField(max_length=255, db_column='Descrizione') # 
Field name made lowercase.
def __unicode__(self):
return self.description
class Meta:
ordering=['description']


class Operation(models.Model):
id = models.AutoField(primary_key=True) # Field name made lowercase.
sign = models.IntegerField(choices=((-1,u'Item in'),(1,u'Item out')),
default=-1,verbose_name=u'OPERATION') # Field name made lowercase.
op_date=models.DateTimeField()
class Meta:
ordering=['-op_date']

class OperationDetail(models.Model):
operation = models.ForeignKey(Operation) # Field name made lowercase.
itemdescription = models.ForeignKey(Item) # Field name made lowercase.
quantity = models.IntegerField(null=True) # Field name made lowercase.
 

in admin.py
...
class OperationDetailInline(admin.TabularInline):
model=OperationDetail
extra=1
save_on_top=True

class OperationOption(admin.ModelAdmin):
list_display = ('sign', 'op_date')
fields=('sign', 'op_date')
inlines=[OperationDetailInline,]
save_on_top=True
order_by=['-op_date',]
..
admin.site.register(Operation,OperationOption)



You see that the field itemdescription (unique=True) of the OperationDetail 
model is linked to Item by means of a foreignkey.


NOW, because this django procedure is going to be operated by people mainly 
using barcode readers what I eagerly need  is to put a search_field (like the 
option available in ModelAdmin) in OperationDetailInline so that people can add 
the inline records by reading the barcode readers the barcode (which is a field 
of the related Item model) as text, click on "search" and have the field 
itemdescription filled with the related item description. Then they can fill 
the remaining fields manually.
Is it possible to reach this result and how?
Ciao from Rome
Vittorio




-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Inserting a search field into a tabularline inline

2013-05-20 Thread Victor
As a newby I started an app that works quite fine. Here are the models (Forgive 
some 'slip of the tongue' but I had to translate my *.py's into English and 
simplify them):

In models.py
.
.
class Item(models.Model):
id = models.AutoField(primary_key=True)
barcode = models.CharField(max_length=30, unique=True, db_index=True) # 
Field name made lowercase.
description = models.CharField(max_length=255, db_column='Descrizione') # 
Field name made lowercase.
def __unicode__(self):
return self.description
class Meta:
ordering=['description']


class Operation(models.Model):
id = models.AutoField(primary_key=True) # Field name made lowercase.
sign = models.IntegerField(choices=((-1,u'Item in'),(1,u'Item out')),
default=-1,verbose_name=u'OPERATION') # Field name made lowercase.
op_date=models.DateTimeField()
class Meta:
ordering=['-op_date']

class OperationDetail(models.Model):
operation = models.ForeignKey(Operation) # Field name made lowercase.
itemdescription = models.ForeignKey(Item) # Field name made lowercase.
quantity = models.IntegerField(null=True) # Field name made lowercase.
 

in admin.py
...
class OperationDetailInline(admin.TabularInline):
model=OperationDetail
extra=1
save_on_top=True

class OperationOption(admin.ModelAdmin):
list_display = ('sign', 'op_date')
fields=('sign', 'op_date')
inlines=[OperationDetailInline,]
save_on_top=True
order_by=['-op_date',]
..
admin.site.register(Operation,OperationOption)



You see that the field itemdescription (unique=True) of the OperationDetail 
model is linked to Item by means of a foreignkey.


NOW, because this django procedure is going to be operated by people mainly 
using barcode readers what I eagerly need  is to put a search_field (like the 
option available in ModelAdmin) in OperationDetailInline so that people can add 
the inline records by reading the barcode readers the barcode (which is a field 
of the related Item model) as text, click on "search" and have the field 
itemdescription filled with the related item description. Then they can fill 
the remaining fields manually.
Is it possible to reach this result and how?
Ciao from Rome
Vittorio


-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Foreign keys to generated through models

2013-05-20 Thread Adrián López Calvo

Hello,

Is this possible?

It would be perfect for my implementation. I would need something alone the 
lines of this:

class Membership(models.Model):

membership = models.OneToOneField(User.groups.through)

date_added = models.DateField(_('date added'), auto_now_add=True)
made_member_by = models.ForeignKey(MEMBER_MODEL, verbose_name=_('user 
who made him a member'), null=True)
membership_justification = models.TextField(_('membership 
justification'), blank=True, default='')

I don't think it is possible, but I'll ask anyway just in case. It would 
make my implementation much easier.

Thanks.

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Variables inside the static tag

2013-05-20 Thread Oscar Carballal
Hi,

I'm migrating to the new static tag in my project, and I ran into a
problem, in some places I use variables to get the content, but that
doesn't work anymore in django 1.5, is there any way to solve this?

Current code:


What it should be (doesn't work):


I've also asked in StackOverflow (http://stackoverflow.com/q/16655851/270293)
and someone suggested to use the "add" functionality, but that doesn't work
either. Any ideas?

Regards,
Oscar

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




postgresql

2013-05-20 Thread Kakar Arunachal Service
hi guyz!
I'm new to django and python, and very new to postgresql. Can u suggest any
books or tutorial for postgresql???

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: postgresql

2013-05-20 Thread Itamar Reis Peixoto
On Mon, May 20, 2013 at 4:35 PM, Kakar Arunachal Service
 wrote:
> hi guyz!
> I'm new to django and python, and very new to postgresql. Can u suggest any
> books or tutorial for postgresql???

try googling for python psycopg

-- 


Itamar Reis Peixoto

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: postgresql

2013-05-20 Thread Charly Román
You don't need a tutorial for Postgresql, django ORM make all the work.

BTW, if you need a tutorial you muts ask in a postgresql group.


2013/5/20 Kakar Arunachal Service :
> hi guyz!
> I'm new to django and python, and very new to postgresql. Can u suggest any
> books or tutorial for postgresql???
>
> --
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Variables inside the static tag

2013-05-20 Thread Nikolas Stevenson-Molnar
How about getting the path to the flags, then tacking on the filename
outside the tag...

{% static "assets/flags/" %}{{ request.LANGUAGE_CODE }}.gif

_Nik

On 5/20/2013 12:13 PM, Oscar Carballal wrote:
> Hi,
>
> I'm migrating to the new static tag in my project, and I ran into a
> problem, in some places I use variables to get the content, but that
> doesn't work anymore in django 1.5, is there any way to solve this?
>
> Current code:
> 
>
> What it should be (doesn't work):
>  alt="{% trans 'Language' %}" title="{% trans 'Language' %}" />
>
> I've also asked in StackOverflow
> (http://stackoverflow.com/q/16655851/270293) and someone suggested to
> use the "add" functionality, but that doesn't work either. Any ideas?
>
> Regards,
> Oscar
> -- 
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: postgresql

2013-05-20 Thread Anurag Chourasia
Read this for a starter

http://www.postgresql.org/docs/9.2/interactive/index.html

Regards,
Guddu

On Mon, May 20, 2013 at 3:35 PM, Kakar Arunachal Service <
kakararunachalserv...@gmail.com> wrote:

> hi guyz!
> I'm new to django and python, and very new to postgresql. Can u suggest
> any books or tutorial for postgresql???
>
> --
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Variables inside the static tag

2013-05-20 Thread Per-Olof Åstrand
You may also look at the get_static_prefix tag, which should also do the 
job for you.

Per-Olof


On Monday, May 20, 2013 9:43:58 PM UTC+2, Nikolas Stevenson-Molnar wrote:
>
> How about getting the path to the flags, then tacking on the filename 
> outside the tag... 
>
> {% static "assets/flags/" %}{{ request.LANGUAGE_CODE }}.gif 
>
> _Nik 
>
> On 5/20/2013 12:13 PM, Oscar Carballal wrote: 
> > Hi, 
> > 
> > I'm migrating to the new static tag in my project, and I ran into a 
> > problem, in some places I use variables to get the content, but that 
> > doesn't work anymore in django 1.5, is there any way to solve this? 
> > 
> > Current code: 
> >  
> > 
> > What it should be (doesn't work): 
> >  > alt="{% trans 'Language' %}" title="{% trans 'Language' %}" /> 
> > 
> > I've also asked in StackOverflow 
> > (http://stackoverflow.com/q/16655851/270293) and someone suggested to 
> > use the "add" functionality, but that doesn't work either. Any ideas? 
> > 
> > Regards, 
> > Oscar 
> > -- 
> > 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...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/django-users?hl=en. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> >   
> >   
>
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Variables inside the static tag

2013-05-20 Thread Oscar Carballal
Both solutions worked, thanks! :D


2013/5/20 Per-Olof Åstrand 

> You may also look at the get_static_prefix tag, which should also do the
> job for you.
>
> Per-Olof
>
>
>
> On Monday, May 20, 2013 9:43:58 PM UTC+2, Nikolas Stevenson-Molnar wrote:
>
>> How about getting the path to the flags, then tacking on the filename
>> outside the tag...
>>
>> {% static "assets/flags/" %}{{ request.LANGUAGE_CODE }}.gif
>>
>> _Nik
>>
>> On 5/20/2013 12:13 PM, Oscar Carballal wrote:
>> > Hi,
>> >
>> > I'm migrating to the new static tag in my project, and I ran into a
>> > problem, in some places I use variables to get the content, but that
>> > doesn't work anymore in django 1.5, is there any way to solve this?
>> >
>> > Current code:
>> > 
>> >
>> > What it should be (doesn't work):
>> > > > alt="{% trans 'Language' %}" title="{% trans 'Language' %}" />
>> >
>> > I've also asked in StackOverflow
>> > (http://stackoverflow.com/q/**16655851/270293)
>> and someone suggested to
>> > use the "add" functionality, but that doesn't work either. Any ideas?
>> >
>> > Regards,
>> > Oscar
>> > --
>> > 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...@**googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at 
>> > http://groups.google.com/**group/django-users?hl=en.
>>
>> > For more options, visit 
>> > https://groups.google.com/**groups/opt_out.
>>
>> >
>> >
>>
>>  --
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Bulk] Re: Template Inheritance doubt

2013-05-20 Thread Sam Solomon
If you are mainly using this for splitting stuff into multiple files, here 
is what we do to accomplish the same thing but keep it so that templates 
always inherit base.html instead of sidebar.html:

base.html:
{% extends 'header.html' %}

{% block main %}

{% endblock main %}

header.html:
{% extends base_footer_template|default:"includes/footer.html" %}

{% block base_everything %}


{% block main %}{% endblock main %}
{% endblock base_everything %}

footer.html:
{% block base_everything %}{% endblock %}




So it's a little weird that the html tags are in header.html and 
footer.html but it does allow the code to be logically separated otherwise.

Also, because of the |default filter, you can render header.html without 
the footer if you need to (we did this for a while when we were playing 
around with "sharing" the overall layout with a wordpress install. (We'd 
have the django server render the header and footer separately and the 
wordpress server would cache the result and use the header and footer in 
it's main template (would only show the logged out versions of the 
header/footer).)

On Monday, May 20, 2013 1:52:15 AM UTC-7, Parin Porecha wrote:
>
> Dow,
> I am using the chained approach which you suggested ( base -> topbar -> 
> sidebar -> view1 ). It works perfectly as i wanted :)
>
> Thanks!
>
>
> On Sun, May 19, 2013 at 10:50 PM, Dow Street 
> > wrote:
>
>> Hi.  I'm not sure, but we may be using the terms 'parent' and 'child' 
>> differently (i.e. what you're calling a child I'm calling a parent?).  I 
>> have only used django template inheritance where a given template file has 
>> at most one {% extends %} tag in it - that is what I am referring to when I 
>> say 'has at most one parent'.  However, the base.html template (the parent) 
>> is extended by many different child templates (e.g. view1.html).  Is this 
>> what you are thinking as well?
>>
>> If you want a template to inherit from multiple parents - e.g. include 
>> multiple {% extends %} tags - well, that is not something I have done 
>> previously (and I can't say whether that model is supported).  However, you 
>> can achieve comparable functionality (I think) by adding a layer in the 
>> inheritance hierarchy - for example:
>>
>> base.html - has empty blocks for topbar and sidebar
>> topbar.html - extends base.html and contains the code for the topbar
>> sidebar.html - extends topbar.html and contains the code for the sidebar
>> view1.html - extends sidebar.html and contains the code specific to that 
>> page
>>
>> If you load the view1.html template in your view function all those {% 
>> extends %} tags will cause the django template engine to walk the 
>> hierarchy, starting from base -> topbar -> sidebar -> view1, leaving you 
>> with a single 'merged' html file.  At each step, if a child template has a 
>> block with the same name as one of the parents, the child block will 
>> overwrite the contents of the parent block.  Does this make sense?
>>
>> (and I should note that I am by no means an expert in the django template 
>> processor - this is just my understanding).
>>
>> R,
>> Dow
>>
>>
>> On May 18, 2013, at 11:12 PM, Parin Porecha 
>> > 
>> wrote:
>>
>> > Dow,
>> > I am trying to have multiple children of the same parent. And thats why 
>> I'm not able to decide which child to load. Anyways, the sidebar and topbar 
>> are more or less static, so I guess there isn't much need to have separate 
>> files for them. I want to have them different so that developing that 
>> section of the website would be easier. In the end, I want to merge all 
>> those different sections into one file and load that in my view. Can you 
>> please help me with this ?
>> >
>> > Artem,
>> > Yes, I get it :) Thanks!
>> >
>> >
>> > On Sat, May 18, 2013 at 9:56 PM, Artem Zinoviev 
>> > > 
>> wrote:
>> > if you have base.html and sidebar.html, base.html file just declare {% 
>> block sidebar %} section and sidebar.html make implementation of it, if you 
>> have SidebarView, then you load sidebar.html and this file take all from {% 
>> extends base.html %}. And if you try load base.html from SidebarView - you 
>> get it :-), but {% block sidebar %} section be blank...
>> >
>> > суббота, 18 мая 2013 г., 12:14:37 UTC+3 пользователь Parin Porecha 
>> написал:
>> > Hi,
>> >
>> > I have just started to learn Django's template inheritance and I am 
>> stuck due to this problem -
>> > In my application's 'base.html', I have defined two blocks -
>> > {% block topbar %}{% endblock topbar %}
>> > and
>> > {% block sidebar %}{% endblock sidebar %}
>> >
>> > I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
>> > and 'topbar.html' which extends {% block topbar %}
>> >
>> > The 'sidebar.html' is also divided into further blocks which are 
>> extended by other templates.
>> >
>> > Now, my question is -
>> > in 'views.py', i have a view which is supposed to render the whole 
>> homepage ( i.e.- including the sidebar, topba

Re: No styling in Chapter 6 in djangobook

2013-05-20 Thread Mike Dewhirst

On 21/05/2013 11:07am, djingo django wrote:


I'm starting to learn Django and have been reading through the
djangobook.com. I am able to get the code running when  I come to
Chapter 6: The Django Admin Site, but it looks nothing like the
well-formed and well-styled screenshots in the documentation. The text
appears ragged and unstyled.

Am I missing a CSS stylesheet to make the admin interface line up and
get styled properly? How can I fix this?


Yes. If you "View page source" in your browser you should see something 
like this ...



href="/static/admin/css/dashboard.css" />


So if the stylesheets cannot be found, which web server are you using?

If you are not using the Django dev server, you need to configure your 
web server to look for such static files in a particular location 
(defined in settings.py as STATIC_ROOT) then run "manage.py 
collectstatic" to put them there.


https://docs.djangoproject.com/en/1.5/howto/static-files/



--
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.