Re: bootstrap django crispy forms

2016-03-01 Thread jarmovanlenthe
You should use #burton in your CSS, not .burton. You set the css_id, not
the css_class to burton.

Jarmo

On Tue, Mar 1, 2016 at 1:39 AM James Schneider 
wrote:

> On Fri, Feb 26, 2016 at 7:39 AM,  wrote:
>
>> A simple upload button is proving difficult to implement bootstrap and
>> css on My attempt is as follows:
>>
>>  class DocumentForm(forms.Form):
>>docfile = forms.FileField(label='Choose')
>>def __init__(self, *args, **kwargs): # don't particularly know or 
>> care about this and the below component
>>  super(DocumentForm, self).__init__(*args, **kwargs) #but they are 
>> necessary to not get an error
>>  ButtonHolder(
>>Div('docfile', style="background: black;", css_class="col-md-12", 
>> css_id="burton", template='home.html')
>>), #the Div part is what I'm most interested in- in order to be 
>> able to style the button.
>>
>> Furthermore, having set the "css_class" to "burton", I have tried
>> referencing it in a normal css file:
>>
>>  .burton{
>> 
>>   }
>>
>> but that too is obviously misguided??
>>
>> Can someone tell me where I'm going wrong?
>>
>
> I answered your other email that had a very similar set of incorrect
> syntax, and provided direction there.
>
>
> https://groups.google.com/d/msgid/django-users/30dc988f-0def-4497-9ca7-9cc514adc5e5%40googlegroups.com?utm_medium=email&utm_source=footer
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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%2BciVtx%3DeXQLH1R9H-HG9J93SQq0U9zd97km7yd%2BpssvnG%2BQ%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/CALqR7pSoqeneUKrVU5Aup35u2KiB_P9orQC4tX8jy%3Dm%2BKVbouw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-01 Thread Jonas Svensson
It seems like you want to use display a default picture if the user does 
not have one.
{% load static %}
{% static "images/default_pic.jpg" as default_pic %}
{{ account.accountuserinfo.picture|default:default_pic }}

Cheers

On Monday, February 29, 2016 at 10:49:53 PM UTC+1, setivo...@gmail.com 
wrote:
>
>
> I need choice base url MEDIA_URL (/media/) - for uploaded user picture, or 
> STATIC_URL (/static/) - picture by default
>
> I am try next:
>
> p> alt="picture_for_{{ account.name }}" id="account_picture">
>
> , but result is MEDIA_URL(STATIC_URL) and path to file.
>
> I am next try:
>
> {% templatetag openvariable %} url 'entry_list' {% templatetag closevariable 
> %}
>
>
> but result is {{ MEDIA_URL }} or {{ STATIC_URL }} (not working)
>
> may by anyone known how solved this problem
> ---
>
> 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/ad20612d-2a90-4108-8737-d4bbe99a262c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Missing button image

2016-03-01 Thread weishengtong
Dear all,

Thank you for your help and sorry for the late reply. This issue is now 
solved. It was indeed related to static files and I just needed to run

$ python manage.py collectstatic

Thanks again.


On Wednesday, February 17, 2016 at 11:03:06 PM UTC, WST wrote:
>
> Hi All,
>
>
> I would appreciate if someone could tell me why the view components will 
> not load? Thank you!
>
>
>
> 
>
>
>

-- 
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/2f9c13b2-f6e1-4f9b-a42f-af6eca50269b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-01 Thread Seti Volkylany
it does not help, because I am image by default


class AccountUserInfo(models.Model):

MAN = 'man'
WOMAN = 'woman'
VAGUE = 'vague'

GENDER_CHOICES = [
(VAGUE, 'Vague'),
(MAN, 'Male'),
(WOMAN, 'Female'),
]

def dispatch_account_media_files(instance, filename):
return '{0}/app_accounts/{1}'.format(instance.account.__str__(),
filename)

account = models.OneToOneField(AccountUser, on_delete=models.CASCADE)
first_name = models.CharField('First name', max_length=50, blank=True,
null=True)
last_name = models.CharField('Last name', max_length=50, blank=True,
null=True)
*picture = models.ImageField('Picture',
upload_to=dispatch_account_media_files, blank=True, null=True)*
gender = models.CharField('Gender', max_length=10,
choices=GENDER_CHOICES, default=GENDER_CHOICES[0][0])
country = CountryField('Country', blank_label='(select country)',
blank=True, null=True)
birthday = models.DateField('Birthday', blank=True, null=True)


--

@property
def picture_url(self):
if self.picture and hasattr(self.picture, 'url'):
return self.picture.url
else:
*return '/project_static/images/default-picture.png'*

But thanks for the advice


On Tue, Mar 1, 2016 at 5:23 PM, Jonas Svensson 
wrote:

> It seems like you want to use display a default picture if the user does
> not have one.
> {% load static %}
> {% static "images/default_pic.jpg" as default_pic %}
> {{ account.accountuserinfo.picture|default:default_pic }}
>
> Cheers
>
> On Monday, February 29, 2016 at 10:49:53 PM UTC+1, setivo...@gmail.com
> wrote:
>>
>>
>> I need choice base url MEDIA_URL (/media/) - for uploaded user picture,
>> or STATIC_URL (/static/) - picture by default
>>
>> I am try next:
>>
>> p>> alt="picture_for_{{ account.name }}" id="account_picture">
>>
>> , but result is MEDIA_URL(STATIC_URL) and path to file.
>>
>> I am next try:
>>
>> {% templatetag openvariable %} url 'entry_list' {% templatetag closevariable 
>> %}
>>
>>
>> but result is {{ MEDIA_URL }} or {{ STATIC_URL }} (not working)
>>
>> may by anyone known how solved this problem
>> ---
>>
>> Thanks
>>
>> --
> 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/5ZJzHbs1sYY/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/ad20612d-2a90-4108-8737-d4bbe99a262c%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/CAGWd_9KBPvrmeVGzNjfrmqAyV5%2BHZaAEsN0DjJtjxVOV2VG%2B1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


problem deploying two apps

2016-03-01 Thread frocco
Hi,

I followed this
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/

First app works fine, if I deploy the second app, the settings conflict and 
images are not rendered.

[code]
Alias /static /var/www/django/track/static


Require all granted




Require all granted





Require all granted


WSGIDaemonProcess track 
python-path=/var/www/django/track:/usr/lib/python2.7/site-packages
WSGIProcessGroup track
WSGIScriptAlias /track /var/www/django/track/track/wsgi.py 
process-group=track
[/code]

[code]
Alias /static /var/www/django/coffee/static


Require all granted




Require all granted





Require all granted


WSGIDaemonProcess coffee 
python-path=/var/www/django/coffee:/usr/lib/python2.7/site-packages
WSGIProcessGroup coffee
WSGIScriptAlias /coffee /var/www/django/coffee/coffee/wsgi.py 
process-group=coffee


[/code]

-- 
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/18651331-b7d0-413c-9847-a5a71ca5c3f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANNOUNCE] Django security releases issued: 1.9.3 and 1.8.10

2016-03-01 Thread Tim Graham
Today the Django team issued 1.9.3 and 1.8.10 as part of our security 
process. This releases address two security issues, and we encourage all 
users to upgrade as soon as possible.

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2016/mar/01/security-releases/

As a reminder, we ask that potential security issues be reported via 
private email to secur...@djangoproject.com and not via Django's Trac 
instance or the django-developers list. Please see 
https://www.djangoproject.com/security for further information.

-- 
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/7dc04e47-533c-46cb-b9e0-eee3367e6f81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem deploying two apps

2016-03-01 Thread Daniel Roseman


On Tuesday, 1 March 2016 16:56:57 UTC, frocco wrote:
>
> Hi,
>
> I followed this
> https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/
>
> First app works fine, if I deploy the second app, the settings conflict 
> and images are not rendered.
>
> [code]
> Alias /static /var/www/django/track/static
>
> 
> Require all granted
> 
>
> 
> 
> Require all granted
> 
> 
>
>
> 
> Require all granted
> 
>
> WSGIDaemonProcess track 
> python-path=/var/www/django/track:/usr/lib/python2.7/site-packages
> WSGIProcessGroup track
> WSGIScriptAlias /track /var/www/django/track/track/wsgi.py 
> process-group=track
> [/code]
>
> [code]
> Alias /static /var/www/django/coffee/static
>
> 
> Require all granted
> 
>
> 
> 
> Require all granted
> 
> 
>
>
> 
> Require all granted
> 
>
> WSGIDaemonProcess coffee 
> python-path=/var/www/django/coffee:/usr/lib/python2.7/site-packages
> WSGIProcessGroup coffee
> WSGIScriptAlias /coffee /var/www/django/coffee/coffee/wsgi.py 
> process-group=coffee
>
>
> [/code]
>


I'm not sure why you are deploying these two apps separately on the same 
server. Usually the two apps would go together under one project, with one 
settings file, and you would deploy that project. collectstatic would take 
care of putting all the static files from both apps in the right place.
--
DR.

-- 
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/e3bbb18a-bdd3-4229-934a-807f663b0fda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to Django

2016-03-01 Thread Chris Bartos
The best way to use Python especially Django is by creating what is called 
a "Virtual Environment". This is a separate instance of Python that you can 
install all the tools that you need to run your Django app without having 
to messing up your current Python instance.

It will also help to freeze the packages you install which is great for 
deploying to different environments and such. But, the steps are pretty 
much the same everything you create a new Virtual Environment. These steps 
are assuming you use a Unix based operating system. If you are using 
Windows, these steps will be a little different.

Step 1: Install 'virtualenv'

First things first. You need to install virtualenv. You can do this with 
the 'pip' command.

$ pip install virtualenv

Step 2: Create your virtual environment

The next step to creating a virtual environment is to actually create it. 
This step will install an instance of Python and also install Pip for you 
so you can install the packages that you want.

$ virtualenv venv

You can call the virtual environment anything you like. I like to call it 
'venv'

Step 3: Activate the virtual environment

This step will change your Python path so that you will use the virtual 
environment version of Python and Pip. You'll notice that when you enter 
this command, you might see '(venv)' next to your commandline. That's how 
you know that you're running the virtual environment

$ source venv/bin/activate

Step 4: Install your packages

You can then install your packages at this point. You'll be happy to know 
that you're packages will be installed inside of your virtual environment. 
So, when you try to 'import django', the Python interpreter will be able to 
find it.

Step 5: Deactivate your virtual environment

When you are done working on your Django app, and you want to exit from 
your virtual environment, simply call:

$ deactivate

You'll be back to your default Python path.

I hope this helps some. If you have any other questions, please let me know!

On Monday, February 29, 2016 at 8:05:12 PM UTC-5, Gary Dhillon wrote:
>
> I've installed Django and I keep getting no module named django when 
> importing. I have python 3.5.1 and used pip to install django 1.9.2. Its 
> showing up on my python 2.7 though. Any help would be appreciated.
>

-- 
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/7caa0d87-b87e-4928-b3c0-e4ebffec62b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem deploying two apps

2016-03-01 Thread James Schneider
On Tue, Mar 1, 2016 at 8:56 AM, frocco  wrote:

> Hi,
>
> I followed this
> https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/modwsgi/
>
> First app works fine, if I deploy the second app, the settings conflict
> and images are not rendered.
>
>
I'm assuming that you have two separate projects that need to run
concurrently, not two separate apps within a single Django project (as the
Django nomenclature would define). Your Apache config would need to be
modified per the answer in this SO:
http://stackoverflow.com/questions/6590587/multiple-mod-wsgi-apps-on-one-virtual-host-directing-to-wrong-app

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


Re: How force DJANGo choice MEDIA_URL or STATIC_URL in template?

2016-03-01 Thread James Schneider
>
>
> I need choice base url MEDIA_URL (/media/) - for uploaded user picture, or
> STATIC_URL (/static/) - picture by default
>
> I am try next:
>
> p> alt="picture_for_{{ account.name }}" id="account_picture">
>
> , but result is MEDIA_URL(STATIC_URL) and path to file.
>
>

You should work your {% if %} statement this way:

{% if account.accountuserinfo.picture %}

{% else %}

{% endif %}

Trying to cram all of that together within the template is awful to read,
and doesn't work as you've seen.

It would also make more sense to have the URL path of the default image set
somewhere other than inside of a property. Either as a global variable for
the model class, or even within your settings.py file and brought in as
part of the template context if it can be used by other areas of the
system. Querying an object instance for a static value like that is not
good style.

-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%2BciVZUn-Ks%3DeLQZKz-0aS%3DbrnkKNU3FOy4y7nBYzMmpfEpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.