Re: static files suspicious operation, os error, and list of paths

2016-07-12 Thread Malik Rumi
UPDATE:

I got it back to where runserver comes up and I get no errors, but the 
staticfiles are still not being served. 


The paths are in the right *format* to satisfy the STATICFILES_DIR in 
SETTINGS, and so that they can be *found*, according to debug toolbar, and 
they *pass* the checks in runserver, collectstatic, and findstatic, but not 
so they can be *used*. 


I have to assume that safe_join is still running around somewhere in the 
background, even though it is now failing silently. 


I need to make safe join see these paths the same way it saw the single 
file bootstrap.css when it passed findstatic, but I don't know how to do 
that. 


One could ask why I get all those 404's from runserver, but I think that's 
explained by the fact that safe_join is still blocking them. 

Ideas?

-- 
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/310bc4fc-c7ec-4fac-aea4-aac1db2546ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-12 Thread Michal Petrucha
On Tue, Jul 12, 2016 at 12:40:11AM -0700, Malik Rumi wrote:
> UPDATE:
> 
> I got it back to where runserver comes up and I get no errors, but the 
> staticfiles are still not being served. 
> 
> 
> The paths are in the right *format* to satisfy the STATICFILES_DIR in 
> SETTINGS, and so that they can be *found*, according to debug toolbar, and 
> they *pass* the checks in runserver, collectstatic, and findstatic, but not 
> so they can be *used*. 
> 
> 
> I have to assume that safe_join is still running around somewhere in the 
> background, even though it is now failing silently. 
> 
> 
> I need to make safe join see these paths the same way it saw the single 
> file bootstrap.css when it passed findstatic, but I don't know how to do 
> that. 
> 
> 
> One could ask why I get all those 404's from runserver, but I think that's 
> explained by the fact that safe_join is still blocking them. 
> 
> Ideas?

Could you please post all the settings that are in any way related to
static files in full? That means things like STATICFILES_*, and
everything that's used in those (like BASE_DIR, etc). Please, don't
leave any part of them out. If you are not certain, just post the
entire settings module, only remove secret values.

Also, could you provide the exact URL of a request that is resulting
in a SuspiciousFileOperation, including a full traceback?

Based on the error message you posted in the initial post, it looks
like somewhere, you're calling ``os.path.join(a, b)``, where the
second argument starts with a slash – that might be the reason, but
it's hard to tell whether this is the case, because you haven't shown
us the full settings.

Cheers,

Michal

-- 
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/20160712100323.GK22177%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


install of django 1.9

2016-07-12 Thread Nicolas Favede
hi everybody
i install with difficulties butdjango 1.9 on my imac
i am used to python 
   run on 2.7.6 coming with terminal but i also installed 3,4 version that 
i call and use when i want
django came there   library/frameworks/python 
frameworks/version3.4/lib/python3.4/django
don't ask me why
now i cannot import django  or if i can cannot use admincmd
i create a myvenv where i try to start project but very difficult
PLEASE SOME HELP
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/99957129-04ad-4d5a-9bba-6819fd93e5af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Annotate on related field

2016-07-12 Thread Ramashish Baranwal
Hi,

I have the following model definitions:

class Tag(models.Model):
name = models.CharField(max_length=16)

class Blog(models.Model):
name = models.CharField(max_length=16)
tags = models.ManyToManyField(Tag, blank=True)



I want to select blogs with more than one tags. Here is what I am doing 
(for two tags)-

# select blogs for python and java
blogs = Blog.objects.filter(tags__name='python').filter(tags__name='java')



This INNER joins Tag with Blog twice, each time filtering on the given 
name. This works well. Now I want to retrieve the matching tags. If it were 
a single join, I would have done-

blogs = blogs.annotate(tag=F('tags__name'))

Doing this still works, but only retrieves the last tag. How do I retrieve 
the tag name for each join, giving them different names? Something like-

# Below should give tag1 = 'python', tag2 = 'java'
blogs = blogs.annotate(tag1=?, tag2=?)

Thanks,
Ramashish

-- 
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/372f27ca-514e-44a0-aeaa-35b8fab67d4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom Models

2016-07-12 Thread anthonytu56
I am relatively new to Django and am hoping somebody can help me. I 
apologise in advance if this is a very simple question.

I have a model that has an expiry date. In my view I have the following:
queryset = 
Post.objects.filter(expiry_date__gt=datetime.now()).order_by('expiry_date')

This works in my ListView.

I have been advised that I should put this in a custom model manager and 
herein lies that the problem. I do not quite understanding how this would 
work. I understand how to create a custom model manager but not the 
realtionship with the view.

Could someone please explian this to me?

Many 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04528a48-e71d-4404-8621-eb650b514a8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Url problem

2016-07-12 Thread VilleP
Hi guys!

I've got a little problem with my url "generating". Everytime I try to run 
my testserver and move through pages, that I've linked there it goes like 
this:

http://testserver.local/home #(this is totally fine)
(click on another page)
http://testserver.local/home/page1
(click on another page besides home)
http://testserver.local/home/page1/page2
(if I click again to previous by clicking menu button it goes like this)
http://testserver.local/home/page1/page2/page1

page1, etc. are examples here which helps me to present the problem.

Any help for this one? I'll paste my urls.py and views.py below:


from django.conf.urls import url
from sivusto import views

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^tekninen.html/$', views.tekninen, name='tekninen'), #(this would be 
page1)
url(r'^johdon_tyokalut.html/$', views.johdon_tyokalut, 
name='johdon_tyokalut'), #(this would be page2)
]


from django.shortcuts import render

def index(request):
return render(request, 'sivusto/index.html',) #(homepage)
def tekninen(request):
return render(request, 'sivusto/tekninen.html',) #(page1)
def johdon_tyokalut(request):
return render(request, 'sivusto/johdon_tyokalut.html',) #(page2)


This is the main main urls.py, if it helps:


from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^sivusto/', include('sivusto.urls', namespace="sivusto")),
]


Thank you very much in advance, I know this sounds like a noob problem but 
that's pretty much what I'm dealing with here :D

-- 
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/c6d46bee-5274-4bf6-acb1-2cbfd12ac876%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


running django 1.9 problem

2016-07-12 Thread Nicolas Favede
hi i am a bit used to python i have a mac coming with 2.7.6 version and 
install 3.4 that i can use if i call
i installed with difficulties django 1.9
it came 
there /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
don't ask me why
now i cannot import or work with
PLEASE SOME HELP
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b98bbc7f-111f-4d00-ab5d-23519ed67b46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I fetch table values in pdf using django?

2016-07-12 Thread Aslam Sha

How do I fetch table values in pdf using django?

** I AM USING REPORTLAB FOR PDP*

-- 
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/aab769ac-6d97-4424-bbe1-7f50c29417d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Custom Models

2016-07-12 Thread AT
Being new to Django I wonder if someone could point me in the right 
direction and I apologise in advance if this is an obvious question.

I have a model with a field that sets an expiry date.

In my ListView I have the following:
queryset = 
Article.objects.filter(expiry_date__gt=datetime.now()).order_by('expiry_date')
Every thing works fine at this point.

Would it be better to include this in a custom manager instead and if so 
how is this handled in the view or is it done just by including:
model = Article

A second point is, if I do this will the expired articles still be 
accessible via the admin?

Many 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52343343-f363-4f73-8a5b-a897a936a08a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Url problem

2016-07-12 Thread James Schneider
On Jul 12, 2016 4:27 AM, "VilleP"  wrote:
>
> Hi guys!
>
> I've got a little problem with my url "generating". Everytime I try to
run my testserver and move through pages, that I've linked there it goes
like this:
>
> http://testserver.local/home #(this is totally fine)
> (click on another page)
> http://testserver.local/home/page1
> (click on another page besides home)
> http://testserver.local/home/page1/page2
> (if I click again to previous by clicking menu button it goes like this)
> http://testserver.local/home/page1/page2/page1
>

This is happening because your site is generating links using a short
relative path (href='page1'). Are you generating URL paths using the Django
methods such as reverse() and {% url %}?

> page1, etc. are examples here which helps me to present the problem.
>
> Any help for this one? I'll paste my urls.py and views.py below:
>
>
> from django.conf.urls import url
> from sivusto import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> url(r'^tekninen.html/$', views.tekninen, name='tekninen'), #(this would
be page1)
> url(r'^johdon_tyokalut.html/$', views.johdon_tyokalut,
name='johdon_tyokalut'), #(this would be page2)
> ]

Can you provide an example of a problematic {% url %} tag from your
template, and the generated HTML on the browser for that same anchor?

Based on the urls.py files you posted, the behavior you describe shouldn't
be possible. Is this behavior seen using the dev server, or using a
production server like Apache?

-James

-- 
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/CA%2Be%2BciUp_3kktVGxR-B5Mw5NyqaFEPHHF-d-J0bQi5-VihQkxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I fetch table values in pdf using django?

2016-07-12 Thread Derek
Here's a good tutorial:

https://assist-software.net/blog/how-create-pdf-files-python-django-application-using-reportlab


On Tuesday, 12 July 2016 13:29:00 UTC+2, Aslam Sha wrote:
>
>
> How do I fetch table values in pdf using django?
>
> ** I AM USING REPORTLAB FOR PDP*
>

-- 
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/b6c6c51e-c8c5-4c53-9d2b-39d6c3adf37d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


json null value in a PostgreSQL jsonb column

2016-07-12 Thread barthelemy
I believe I found a limitation in the Django jsonb support, but I'm really 
not sure how the framework could fix it beside adding a limitation section 
in the documentation.

Basically, it is possible to fetch models with json 'null' values but it is 
not possible to save them back (Django converts the json 'null' value to 
sql NULL value).

Assume the following model:

class Container(models.Model):
data = JSONField(blank=False, null=False) # emphasis on null=False


In PostgreSQL, it is perfectly reasonable to do this:

INSERT INTO container VALUES (1, 'null');


If you fetch the row in Django, you will get this:

container = Container.objects.get(pk=1)

assert container.data is None # passes

container.save() # raises IntegrityError because it tries to save NULL in a 
NOT NULL column.


This is because Django has no idea whether you want to store None or 
'null'::jsonb.


I'm not sure if this limitation was discussed elsewhere. I found a 
somehow-related ticket here: https://code.djangoproject.com/ticket/25718.


Barthélémy

-- 
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/cf59a2a5-2472-4091-ac87-180884e0c076%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create navbar dropdown menu list with url tags

2016-07-12 Thread Prog Nauts
ok clear

Il giorno mercoledì 6 luglio 2016 16:27:41 UTC+2, pythonc...@gmail.com ha 
scritto:
>
> Hi,
> I have a model and whould like to create a dropdown menu from the fields 
> generated.
> Unfortunately no dropdown list is showed:
>  
>  {% for airline in alirlines %}
>
> {{ 
> airline.airline }}
>{% endfor %}
>
>   
>
> this is the model:
> class Airline(models.Model):
>  airline = models.CharField(max_length=50)
>  prefix = models.CharField(max_length=3)
>  code= models.CharField(max_length=3)
>  ticker = models.CharField(max_length=1)
>
>
> can anyone help? 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4d96446-296a-4115-a990-a7733c236255%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django_bootstrap_calendar and admin backend

2016-07-12 Thread Cronos Cto
Ok so I was able to fix one of my problems, consisted in framework not 
recognizing the database, had to delete it and migrate everything again. 
Right now I can add events in my backend, but when I check my website the 
day where I have set the  event lights up, but does not show title, hour or 
anything... 

-- 
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/7ced5f5a-ab52-4028-a234-5bed6635426c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django_bootstrap_calendar and admin backend

2016-07-12 Thread Cronos Cto
Ok so I was able to fix one of my problems, consisted in framework not 
recognizing the database, had to delete it and migrate everything again. 
Right now I can add events in my backend, but when I check my website the 
day where I have set the  event lights up, but does not show title, hour or 
anything... 


-- 
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/09215dec-54a1-48ea-8b47-bb71a40ce453%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Fellipe Henrique
On Thu, Jul 7, 2016 at 5:24 PM, Michal Petrucha <
michal.petru...@konk.org> wrote:

> In that case, the “DATASET” would be the verbose_name of that field,
> and “Dataset_users object” is the string representation of the
> original original object that the row corresponds to.
>

Unfortunately no.. :(

I have set all verbose_name and verbose_name_plural, on all models.. and
all models have str representation.. but still show these dataset_users
object... instead the verbose_name

These "problem" occur only when I have M2M field.. in other FK fields
doesn't appears..


T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
*
*Blog: *http:www.fellipeh.eti.br
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

-- 
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/CAF1jwZF3Bg1mUvoZMzx%3DATUMrsSUfk5B8kLZh6%3Di%2BZZLpth3qw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Newbie question regarding uninstalling Django system-wide.

2016-07-12 Thread Leo


I am learning how to use Django. With my first attempt I did not use a 
virtual environment instead installed Django system-wide. Now I have 
learned to utilize virtual environments. Can you help me learn how to 
uninstall the system-wide Django instance? Also, I can't recall if I used 
pip or apt-get. Or do I need to be concerned with this at all, meaning will 
the base install conflict with instances installed in the virtual 
environments?


Your help is appreciated.

Leo

-- 
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/638a94f9-8bb8-40c4-80f2-204b0479dc74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Ramiro Morales
On Tue, Jul 12, 2016 at 12:54 PM, Fellipe Henrique 
wrote:

>
> On Thu, Jul 7, 2016 at 5:24 PM, Michal Petrucha <
> michal.petru...@konk.org> wrote:
>
>> In that case, the “DATASET” would be the verbose_name of that field,
>> and “Dataset_users object” is the string representation of the
>> original original object that the row corresponds to.
>>
>
> Unfortunately no.. :(
>
> I have set all verbose_name and verbose_name_plural, on all models.. and
> all models have str representation.. but still show these dataset_users
> object... instead the verbose_name
>
> These "problem" occur only when I have M2M field.. in other FK fields
> doesn't appears..
>


Can you post a simplified excerpt of the relevant (fields, Meta options,
__*__ methods) models, admin app ModelAdmin's and *Inline's involved which
result in the layout depicted in the screenshot you posted?

Regards,

-- 
Ramiro Morales
@ramiromorales

-- 
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/CAO7PdF8owYdEzwVhsDvF%2BXoC-86MbTE-%2BRcnZRcF27TZq3m4_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Fellipe Henrique
On Tue, Jul 12, 2016 at 1:34 PM, Ramiro Morales  wrote:

> Can you post a simplified excerpt of the relevant (fields, Meta options,
> __*__ methods) models, admin app ModelAdmin's and *Inline's involved which
> result in the layout depicted in the screenshot you posted?
>

Sure, here is:

class Dataset(models.Model):
active = models.BooleanField(_('Ativo'), default=True)
title = models.CharField(_('Nome'), max_length=250)
users = models.ManyToManyField(MyCustomUser)

class Meta:
verbose_name = _('Dataset')
verbose_name_plural = _('Datasets')

def __str__(self):
return self.title


class MyCustomUser(AbstractBaseUser, PermissionsMixin):
username = models.CharField(
_('Nome do usuário'), max_length=200, blank=True, null=True)
email = models.EmailField(
_('Endereço de E-Mail'), blank=False, unique=True)
first_name = models.CharField(_('Nome'), max_length=30, blank=True)
last_name = models.CharField(
_('Sobrenome'), max_length=30, blank=True, default='')
is_staff = models.BooleanField(_('Administrador?'), default=False)
is_active = models.BooleanField(_('Usuário Ativo?'), default=True)
date_joined = models.DateTimeField(
_('Data Cadastro'), default=timezone.now)

objects = CustomUserManager()

USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['first_name']

class Meta:
verbose_name = _('Usuário')
verbose_name_plural = _('Usuários')

def __str__(self):
if self.first_name or self.last_name:
return self.get_full_name()
return self.email

Admin:

class DatasetInline(admin.TabularInline):
model = Dataset.users.through
verbose_name = _('Dataset')
verbose_name_plural = _('Datasets')


class MyCustomUserAdmin(UserAdmin):
model = User
add_fieldsets = (None, {
'classes': ('wide',),
'fields': (
'email', 'password1', 'password2', 'first_name', 'last_name',
'is_superuser'),
}),

fieldsets = (
(None, {'fields': ('email', 'password')}),
(_('Personal info'), {'fields': (
'first_name', 'last_name')}),
(_('Permissions'), {'fields': ('is_active', 'is_superuser')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)

ordering = ('first_name', 'email')
list_display = ('email', 'first_name', 'last_name')
inlines = [DatasetInline]
list_filter = ('is_active', 'is_superuser')


admin.site.register(User, MyCustomUserAdmin)


The results:

[image: Inline image 1]

Cheers!


T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
*
*Blog: *http:www.fellipeh.eti.br
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

-- 
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/CAF1jwZHuJNH8pWQO1EF2VXZNUC64-ssneSfwNARe%3DCsi0x0iSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Ramiro Morales
On Tue, Jul 12, 2016 at 1:44 PM, Fellipe Henrique 
wrote:

>
> On Tue, Jul 12, 2016 at 1:34 PM, Ramiro Morales  wrote:
>
>> Can you post a simplified excerpt of the relevant (fields, Meta options,
>> __*__ methods) models, admin app ModelAdmin's and *Inline's involved which
>> result in the layout depicted in the screenshot you posted?
>>
>
> Sure, here is:
> [...]
>
>
Where the 'Conjunto de dados' seen in the screenshot title comes from? Is
the code you posted actually in sync with it?

-- 
Ramiro Morales
@ramiromorales

-- 
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/CAO7PdF8vzCTb9PCpzVw%2BeOyQ%3DfoWH%2B4emwGPNQNM%2BAR-0U9r4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Fellipe Henrique
On Tue, Jul 12, 2016 at 1:52 PM, Ramiro Morales  wrote:

> Where the 'Conjunto de dados' seen in the screenshot title comes from? Is
> the code you posted actually in sync with it?


Sorry about that, I take the screenshot before change these text to
"DataSet"...

[image: Inline image 1]

My problem is, the second "Dataset" (on light gray line) and "Dataset_users
object"

T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
*
*Blog: *http:www.fellipeh.eti.br
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

-- 
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/CAF1jwZF2WwricBicEKxPL7eWsp%2BQrTuD7YgCQueNfKAWzyTDrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files suspicious operation, os error, and list of paths

2016-07-12 Thread Malik Rumi
Michal,

> , it looks like somewhere, you're calling ``os.path.join(a, b)``, where
the second argument starts with a slash

I've tried it both ways. The way I got findstatic to work was by taking off
the leading slash, but so far I haven't figured out how to make that work
so that the files are called.

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'essell',
'csvimport2',
'debug_toolbar',
'account',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'static/bootstrap'),
os.path.join(BASE_DIR, 'static/bootstrap/css/'),
os.path.join(BASE_DIR, 'static/bootstrap/fonts/'),
os.path.join(BASE_DIR, 'static/bootstrap/js/'),
os.path.join(BASE_DIR, 'static/css/'),
os.path.join(BASE_DIR, 'static/email_templates/'),
os.path.join(BASE_DIR, 'static/fonts/'),
os.path.join(BASE_DIR, 'static/images/'),
os.path.join(BASE_DIR, 'static/js/'),
os.path.join(BASE_DIR, 'static/less/'),
os.path.join(BASE_DIR, 'static/plugins/'),
os.path.join(BASE_DIR, 'static/videos/'),
]

# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'




On Tue, Jul 12, 2016 at 3:03 AM, Michal Petrucha <
michal.petru...@konk.org> wrote:

> On Tue, Jul 12, 2016 at 12:40:11AM -0700, Malik Rumi wrote:
> > UPDATE:
> >
> > I got it back to where runserver comes up and I get no errors, but the
> > staticfiles are still not being served.
> >
> >
> > The paths are in the right *format* to satisfy the STATICFILES_DIR in
> > SETTINGS, and so that they can be *found*, according to debug toolbar,
> and
> > they *pass* the checks in runserver, collectstatic, and findstatic, but
> not
> > so they can be *used*.
> >
> >
> > I have to assume that safe_join is still running around somewhere in the
> > background, even though it is now failing silently.
> >
> >
> > I need to make safe join see these paths the same way it saw the single
> > file bootstrap.css when it passed findstatic, but I don't know how to do
> > that.
> >
> >
> > One could ask why I get all those 404's from runserver, but I think
> that's
> > explained by the fact that safe_join is still blocking them.
> >
> > Ideas?
>
> Could you please post all the settings that are in any way related to
> static files in full? That means things like STATICFILES_*, and
> everything that's used in those (like BASE_DIR, etc). Please, don't
> leave any part of them out. If you are not certain, just post the
> entire settings module, only remove secret values.
>
> Also, could you provide the exact URL of a request that is resulting
> in a SuspiciousFileOperation, including a full traceback?
>
> Based on the error message you posted in the initial post, it looks
> like somewhere, you're calling ``os.path.join(a, b)``, where the
> second argument starts with a slash – that might be the reason, but
> it's hard to tell whether this is the case, because you haven't shown
> us the full settings.
>
> Cheers,
>
> Michal
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/MoWUYN4SJmk/unsubscribe.
> To unsubscribe from this group and all its topics, 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/20160712100323.GK22177%40konk.org
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

"Every time you see a black kid wearing a hoodie, you say: There's a thug.
If you see a white kid wearing hoodie, you say: There's Mark Zuckerberg,"
Jones told USA TODAY

last
year.

"I said, 'That's because of racism. And Prince said, 'Maybe so

Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Lachlan Musicman
There's a ticket for this in the tracker iirc, but I can't find it now. I
think the reason is because that's the name of the DB field - it's not
localizable (in so much as we don't localize db field names).

I *think* that was the reason.

--
The most dangerous phrase in the language is, "We've always done it this
way."

- Grace Hopper

On 13 July 2016 at 03:42, Fellipe Henrique  wrote:

>
> On Tue, Jul 12, 2016 at 1:52 PM, Ramiro Morales  wrote:
>
>> Where the 'Conjunto de dados' seen in the screenshot title comes from? Is
>> the code you posted actually in sync with it?
>
>
> Sorry about that, I take the screenshot before change these text to
> "DataSet"...
>
> [image: Inline image 1]
>
> My problem is, the second "Dataset" (on light gray line) and
> "Dataset_users object"
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
> *
> *Blog: *http:www.fellipeh.eti.br
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
> --
> 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/CAF1jwZF2WwricBicEKxPL7eWsp%2BQrTuD7YgCQueNfKAWzyTDrA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGBeqiN0TMULASBEgjzb3TJENDchTO8bU%2BYSLC8dVN5mg13iow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie question regarding uninstalling Django system-wide.

2016-07-12 Thread Mike Dewhirst

On 13/07/2016 1:55 AM, Leo wrote:

I am learning how to use Django. With my first attempt I did not use a
virtual environment instead installed Django system-wide. Now I have
learned to utilize virtual environments. Can you help me learn how to
uninstall the system-wide Django instance? Also, I can't recall if I
used pip or apt-get. Or do I need to be concerned with this at all,
meaning will the base install conflict with instances installed in the
virtual environments?


sudo pip uninstall django

sudo apt-get remove django

The base install is unnecessary if Django is installed in the venv and 
it should not conflict.


It is best to avoid any base installs unless you *know* they will be 
used by all venvs






Your help is appreciated.

Leo

--
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/638a94f9-8bb8-40c4-80f2-204b0479dc74%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
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/71ea4c0f-886d-7fa7-8c8e-267f9cb93715%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.