Re: django.core.exceptions.ImproperlyConfigured:

2017-10-02 Thread ADEWALE ADISA
are u sure u are running the command from the root of your project where
the folder "website" and file manage.py is ?
try to cd to your project root, then run
python manage.py runserver
On Oct 2, 2017 6:51 AM, "harsh sharma"  wrote:

> i am getting this error whenever i m trying to run django-admin runserver
>
> django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but
> settings are not configured. You must eit
> her define the environment variable DJANGO_SETTINGS_MODULE or call
> settings.configure() before accessing settings.
>
> my wsgi file
>
> import os
> from django.conf import settings
> from django.core.wsgi import get_wsgi_application
>
> settings.configure(DEBUG=True)
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")
>
> application = get_wsgi_application()
>
> --
> 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/568cdb67-2a6f-4e3b-9ba8-842d0c721e7a%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/CAMGzuy-fCGft6__LEfU1JaieorsLCJZE---PRNQkCVBKBRdUBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: figuring out bug with django cookies: not working on server

2017-10-02 Thread Samuel Muiruri
@login_required
def edit_service(request, service_id, template_name="edit-service.html"):
context = RequestContext(request)

context['service_id'] = request.COOKIES.get('service_id', None)

...

response = render_to_response(template_name, context)
response.set_cookie('service_id', service_id)

return response

On Tue, Oct 3, 2017 at 1:05 AM, ADEWALE ADISA 
wrote:

> can you show the code where you set the cookie before retrieving it
> On Oct 2, 2017 6:35 PM, "Samuel Muiruri"  wrote:
>
>> I have a site that relies on checking if a cookie exists for service_id and
>> if it does checks if you can upload files for service... this works nicely
>> offline but on pushing changes to server it created a bug where even though
>> the cookie can be seen (on the dev console)
>>
>> [image: enter image description here]
>> 
>>
>> and I assign the cookie to a context variable which ends up saying None even
>> though I can see the cookie from the dev console.
>>
>> class PictureCreateView(CreateView):
>> model = Picture
>> fields = "__all__"
>> template_name = 'accounts/upload-file.html'
>>
>> def get_context_data(self, **kwargs):
>>
>> context = super(PictureCreateView, self).get_context_data(**kwargs)
>> context['service_id'] = self.request.COOKIES.get('service_id', None)
>>
>> return context
>>
>> on the template
>>
>> {% if service_id %}
>> #display form{% else %}
>> Sorry it seems you're missing some vital data needed before ...
>> {% endif %}
>>
>> any ideas?
>>
>> here's a screen record (local & live): https://youtu.be/aud59Avp1aI
>>
>> --
>> 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/ms
>> gid/django-users/fd1f686b-dded-4aaa-8f6b-274419afa0a1%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/mSWmg0HVxz0/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/CAMGzuy-N_znhTLZqD0zc4ED78pFNAgCH3ns17eY
> R3ZR0xOrcyQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Best Regards,

Samuel Muiruri.

Web Designer | +254 738 940064

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


Re: figuring out bug with django cookies: not working on server

2017-10-02 Thread ADEWALE ADISA
can you show the code where you set the cookie before retrieving it
On Oct 2, 2017 6:35 PM, "Samuel Muiruri"  wrote:

> I have a site that relies on checking if a cookie exists for service_id and
> if it does checks if you can upload files for service... this works nicely
> offline but on pushing changes to server it created a bug where even though
> the cookie can be seen (on the dev console)
>
> [image: enter image description here]
> 
>
> and I assign the cookie to a context variable which ends up saying None even
> though I can see the cookie from the dev console.
>
> class PictureCreateView(CreateView):
> model = Picture
> fields = "__all__"
> template_name = 'accounts/upload-file.html'
>
> def get_context_data(self, **kwargs):
>
> context = super(PictureCreateView, self).get_context_data(**kwargs)
> context['service_id'] = self.request.COOKIES.get('service_id', None)
>
> return context
>
> on the template
>
> {% if service_id %}
> #display form{% else %}
> Sorry it seems you're missing some vital data needed before ...
> {% endif %}
>
> any ideas?
>
> here's a screen record (local & live): https://youtu.be/aud59Avp1aI
>
> --
> 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/fd1f686b-dded-4aaa-8f6b-274419afa0a1%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/CAMGzuy-N_znhTLZqD0zc4ED78pFNAgCH3ns17eYR3ZR0xOrcyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


QueryDict and unicode

2017-10-02 Thread Alexey Lozickiy
Hi all,

Why is it so that QueryDict for PY3 handles input query string different 
from PY2 (part of __init__ of QueryDict from Django 1.11.5):

if six.PY3:
if isinstance(query_string, bytes):
# query_string normally contains URL-encoded data, a subset of 
ASCII.
try:
query_string = query_string.decode(encoding)
except UnicodeDecodeError:
# ... but some user agents are misbehaving :-(
query_string = query_string.decode('iso-8859-1')
for key, value in limited_parse_qsl(query_string, **parse_qsl_kwargs):
self.appendlist(key, value)
else:
for key, value in limited_parse_qsl(query_string, **parse_qsl_kwargs):
try:
value = value.decode(encoding)
except UnicodeDecodeError:
value = value.decode('iso-8859-1')
self.appendlist(force_text(key, encoding, errors='replace'),
value)

Firstly, for PY3 decoding is done only once, for entire query string, while 
for PY2 query is parsed first, and then each value is decoded separately.
Secondly, for PY3 query_string is being decoded only if it is of bytes 
type. Why there is no such check for PY2? Why not to decode only if it's 
not unicode?

With such implementation it is not possible to pass unicode object that 
contains non-ascii characters to QueryDict.

Can somebody give me a hint on why things wre done in this way?

Thanks,
Alexey.

-- 
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/f7e3ea04-b2c9-4baa-bb50-d56768b9b91f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Heroku Git Error

2017-10-02 Thread Aaron Weisberg
Hi everyone,

It's a miracle I've gotten this far with the amount of knowledge that I 
don't have with coding, hosting, django, heroku, git etc.  However, I've 
been using a heroku server to serve my website for the last couple of 
months and I've been able to do so without any issues.

However, last week I was away from my office and i tried to make some 
changes to my site via a new machine, which I knew was a bad idea.  I 
committed one change, never pushed it using "git push heroku master" and 
then deleted the change using git reset


Now that I'm back in my office at my original machine, I'm having all sorts 
of issues and I cannot commit any changes or even hookup with git on the 
same page.

When I try to push to heroku master I get:
![rejected] master --> master (non-fast forward)
error: failed to push some refs to 'https://git.heroku...
Updates were rejectred because the tip of your current batch is behind its 
remote counterpart.  Integrate the remote changes (e.g. git pull) before 
pushing again

okay- well that's all well and good, but I can't perform git pull, git 
fetch or anything along those lines either.

I get:

Permission denied (publickey) fatal could not read from repository
Please make sure you have the correct access rights and the repository 
exists

Please help!

Thanks,

Aaron

-- 
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/1ada81a0-3138-489d-b7b9-74b8c83e600a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access data associated to a primary key

2017-10-02 Thread tango ward
Holy .. it works!

I have to access the Team_Name class using the 'related_name=regions' and
from that, I was able to access the logo attributes of Team_Name.

Here's what I did.

{% block body_block %}


{% for region in regions_detail.regions.all %}





{% endfor %}


{% endblock %}


Thanks for your help Gourav. By the way, do you know when should I use CBV
and function view?

On Mon, Oct 2, 2017 at 9:31 PM, Gourav Chawla <
gauravchawla.chawla...@gmail.com> wrote:

> You can create another url, view, template to do that.
>
> Just create a url like : team/id
>
> For the above url create a view, say, teams_under_region which accepts the
> 'id'. Based on that id you can then query your database for teams where
> region_member=id. This is just the approach you would follow for functional
> view. But for CBV you have DetailView that takes care of this. Hope this
> helps.
>
>
> On Monday, October 2, 2017 at 2:53:04 PM UTC+5:30, tangoward15 wrote:
>>
>> Hi guys, I just want to know how to access and load the data associated
>> to a primary key in a template.
>>
>> models.py
>>
>> class Team_Region(models.Model):
>> name = models.CharField(max_length=50)
>>
>> # String representation
>> def __str__(self):
>> return self.name
>>
>>
>>
>> class Team_Name(models.Model):
>> t_name = models.CharField(max_length=100)
>> logo = models.ImageField(upload_to='team_logos', blank=True)
>> region_member = models.ForeignKey(Team_Region, related_name='regions')
>>
>>
>> def __str__(self):
>> return self.t_name + ' - ' + str(self.region_member)
>>
>>
>>
>>
>> views.py
>>
>> class TeamRegionListView(ListView):
>> context_object_name = 'regions_listview'
>> model = Team_Region
>> template_name = 'dota_teams/team_regions_list.html'
>>
>>
>> team_regions_list.html
>>
>> {% block body_block %}
>>
>> 
>> {% for region in regions_listview %}
>> 
>> {{
>> region.name }}
>> 
>> {% endfor %}
>> 
>>
>> {% endblock %}
>>
>>
>> What I want to achieve is to load the teams' logos and names when the
>> region name link is clicked in the team_regions.html. The teams that will
>> only be displayed in the template are the teams part of the specific ID
>> from Team_Region. Say, region is NA, I want all teams under NA to be
>> displayed in the template.
>>
>> Not sure how to do this using ListView.
>>
>> Any suggestions?
>>
>>
>> TIA
>>
> --
> 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/1b7d75bb-e5ed-4cc5-8b30-7d6487dcb966%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/CAA6wQLJGX5Ai_L6Cxv0c1BZWpdzwX8Z-pUuHu%3DdaVaxxuwVHyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access data associated to a primary key

2017-10-02 Thread tango ward
Hi Gourav, thanks for the input.

Just a question, Can I iterate through the Team_Region to get the teams
listed under the specific id? or shall I do it in Team_Member class? This
is for the DetailView.

On Mon, Oct 2, 2017 at 9:31 PM, Gourav Chawla <
gauravchawla.chawla...@gmail.com> wrote:

> You can create another url, view, template to do that.
>
> Just create a url like : team/id
>
> For the above url create a view, say, teams_under_region which accepts the
> 'id'. Based on that id you can then query your database for teams where
> region_member=id. This is just the approach you would follow for functional
> view. But for CBV you have DetailView that takes care of this. Hope this
> helps.
>
>
> On Monday, October 2, 2017 at 2:53:04 PM UTC+5:30, tangoward15 wrote:
>>
>> Hi guys, I just want to know how to access and load the data associated
>> to a primary key in a template.
>>
>> models.py
>>
>> class Team_Region(models.Model):
>> name = models.CharField(max_length=50)
>>
>> # String representation
>> def __str__(self):
>> return self.name
>>
>>
>>
>> class Team_Name(models.Model):
>> t_name = models.CharField(max_length=100)
>> logo = models.ImageField(upload_to='team_logos', blank=True)
>> region_member = models.ForeignKey(Team_Region, related_name='regions')
>>
>>
>> def __str__(self):
>> return self.t_name + ' - ' + str(self.region_member)
>>
>>
>>
>>
>> views.py
>>
>> class TeamRegionListView(ListView):
>> context_object_name = 'regions_listview'
>> model = Team_Region
>> template_name = 'dota_teams/team_regions_list.html'
>>
>>
>> team_regions_list.html
>>
>> {% block body_block %}
>>
>> 
>> {% for region in regions_listview %}
>> 
>> {{
>> region.name }}
>> 
>> {% endfor %}
>> 
>>
>> {% endblock %}
>>
>>
>> What I want to achieve is to load the teams' logos and names when the
>> region name link is clicked in the team_regions.html. The teams that will
>> only be displayed in the template are the teams part of the specific ID
>> from Team_Region. Say, region is NA, I want all teams under NA to be
>> displayed in the template.
>>
>> Not sure how to do this using ListView.
>>
>> Any suggestions?
>>
>>
>> TIA
>>
> --
> 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/1b7d75bb-e5ed-4cc5-8b30-7d6487dcb966%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/CAA6wQL%2Bm%2BYCeFR8rur2NiStqFW_0NGVEH8S-G3KE7am8BSs1cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Implementation Advice: Categories and Product Specifications

2017-10-02 Thread Paul
 

I have Product and Categories. A product can be in multiple categories and 
off course a Category have multiple products.


The Categories can have Subcategories’ which can have Subcategories. I used 
a Category Model with a circular Foreign Key.


Each Product can have specifications/attributes based in which Categories 
is. 


So the specifications are of the products but depends on the Categories.


I can’t add the specifications as Products attributes because they depend 
on categories, and the user can change categories.


I can’t add them as attributes per Category because the value are/can be 
different for each product.


Also an attribute/specification can appear in multiple Categories.


I want also to search for a Product filtering by attributes.


I think I need a separate Attribute Model that is linked (foreign key) to 
both Product and Category.


Also a way of “protection” in case a Product change categories, a Product 
and/or a Category is deleted.


What is the optimal approach as flexibility and performance ? 

-- 
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/adf6c608-45fd-4c5f-a8c1-7a11b67fc3b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What's the simple way to implement a chat system in Django?

2017-10-02 Thread Samuel Muiruri
You'll end up needing to use sockets to get a "live chat"  and channels is 
one of the quickest way to get there.

On Monday, October 2, 2017 at 6:39:48 PM UTC+3, Kishore Srinivas wrote:
>
> I want to make a chat system in Django, but all those channel stuffs looks 
> difficult , so are there any other simpler way to implement a chat system, 
> 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/9e91ab0a-8882-4714-b72d-c04cef859e74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


figuring out bug with django cookies: not working on server

2017-10-02 Thread Samuel Muiruri


I have a site that relies on checking if a cookie exists for service_id and 
if it does checks if you can upload files for service... this works nicely 
offline but on pushing changes to server it created a bug where even though 
the cookie can be seen (on the dev console)

[image: enter image description here] 

and I assign the cookie to a context variable which ends up saying None even 
though I can see the cookie from the dev console.

class PictureCreateView(CreateView):
model = Picture
fields = "__all__"
template_name = 'accounts/upload-file.html'

def get_context_data(self, **kwargs):

context = super(PictureCreateView, self).get_context_data(**kwargs)
context['service_id'] = self.request.COOKIES.get('service_id', None)

return context

on the template

{% if service_id %}
#display form{% else %}
Sorry it seems you're missing some vital data needed before ...
{% endif %}

any ideas?

here's a screen record (local & live): https://youtu.be/aud59Avp1aI

-- 
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/fd1f686b-dded-4aaa-8f6b-274419afa0a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with staticfiles in deployment

2017-10-02 Thread Alexander Joseph
It was my nginx configuration. I hadnt noticed the staticfiles directory 
was pointing to the wrong place. Thanks for the help!

On Sunday, October 1, 2017 at 9:37:04 PM UTC-6, Alexander Joseph wrote:
>
> environ allows you to use environment variables in your settings files, 
> heres the docs
> https://django-environ.readthedocs.io/en/latest/#
>
> and my nginx config look like this... thanks
>
> server {
> listen 80;
> server_name [domain name];
> ssl_dhparam /etc/ssl/certs/dhparam.pem;
>
> location = /favicon.ico { access_log off; log_not_found off; }
> location /staticfiles/ {
> root /home/business_management;
> }
>
> location / {
> include proxy_params;
> proxy_pass 
> http://unix:/home/business_management/business_management.sock;
> }
> }
>
>
>
>
>
> On Saturday, September 30, 2017 at 6:40:46 PM UTC-6, Alexander Joseph 
> wrote:
>>
>> Hello,
>>
>> My site is deployed on an ubuntu/nginx/gunicorn droplet on digitalOcean. 
>> For some reason my static files are not updating after running 
>> collectstatic. I have access to older static files but cant make updates to 
>> static files and see them in production. It works as it should on my 
>> development computer. Its kind of like my staticfiles storage is some CDN 
>> that I wasnt aware of and now when I run collectstatic its not putting the 
>> files in the CDN anymore
>>
>> Below is my base settings configuration
>>
>> # settings/base.py
>>
>> import environ
>>
>> ROOT_DIR = environ.Path(__file__) - 3  # 
>> (business_management/config/settings/base.py - 3 = business_management/)
>> APPS_DIR = ROOT_DIR.path('business_management')
>>
>> # Load operating system environment variables and then prepare to use them
>> env = environ.Env()
>>
>> # .env file, should load only in development environment
>> READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
>>
>> if READ_DOT_ENV_FILE:
>> # Operating System Environment variables have precedence over 
>> variables defined in the .env file,
>> # that is to say variables from the .env files will only be used if 
>> not defined
>> # as environment variables.
>> env_file = str(ROOT_DIR.path('.env'))
>> print('Loading : {}'.format(env_file))
>> env.read_env(env_file)
>> print('The .env file has been loaded. See base.py for more 
>> information')
>>
>>
>> # DEBUG
>> # 
>> --
>> # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
>> DEBUG = env.bool('DJANGO_DEBUG', False)
>>
>>
>> # Application definition
>> # 
>> --
>>
>> INSTALLED_APPS = [
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 
>> 'django.contrib.sites',
>> 'allauth',
>> 'allauth.account',
>> 'allauth.socialaccount',
>> 'allauth_office365',
>> 
>> 'bootstrap4',
>> 
>> 'business_management.accounts',
>> 'business_management.engineering',
>> ]
>>
>> #SOCIALACCOUNT_ADAPTER = 'allauth_office365.adapter.SocialAccountAdapter'
>> SOCIALACCOUNT_EMAIL_VERIFICATION = False
>>
>> SOCIALACCOUNT_PROVIDERS = {
>> 'office365': {
>>   'SCOPE': ['User.read',],
>>   'USERNAME_FIELD': 'mail'
>> }
>> }
>>
>> MIDDLEWARE = [
>> 'django.middleware.security.SecurityMiddleware',
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware',
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> ]
>>
>> ROOT_URLCONF = 'config.urls'
>>
>>
>> TEMPLATES = [
>> {
>> # See: 
>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> # See: 
>> https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
>> 'DIRS': [
>> str(APPS_DIR.path('templates')),
>> ],
>> 'OPTIONS': {
>> # See: 
>> https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
>> 'debug': DEBUG,
>> # See: 
>> https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
>> # 
>> https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
>> 'loaders': [
>> 'django.template.loaders.filesystem.Loader',
>> 'django.template.loaders.app_directories.Loader',
>> ],
>> # See: 
>> https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
>> 'context_processors': [
>> 

What's the simple way to implement a chat system in Django?

2017-10-02 Thread Kishore Srinivas
I want to make a chat system in Django, but all those channel stuffs looks 
difficult , so are there any other simpler way to implement a chat system, 
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/dde2045d-3cba-4484-a43f-e92d1d4a27d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up Django for the first time, urls.py and settings.py

2017-10-02 Thread Kishore Srinivas
Always have the documentation with you while following the old 
tutorials.when I was starting Django I had big problems while using a 
tutorial in Django 1.7 with Django 1.10, nothing worked, but using 
documentation you can pretty much find what had changed 


-- 
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/b5826103-e3b4-40c0-a5e6-144e19427695%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to create a custom widget using django for use on external sites

2017-10-02 Thread Frankline
I hava a new site that I am working on. The site will have prior agreement
with eCommerce sites to include add-ons on their website.

Consider the following example:
My website, ABC.com is targeting ecommerce sites.
For every ecommerce site that sells product X, I want them to include an
add-on that gives buyers the option to purchase service Z if they so
desire.
ABC.com will be communicating with the ecommerce sites through a REST API.

My challenge is how to integrate my service as an add-on into the external
ecommerce sites. This I assume will be in the form of a widget, HTML code,
or a bit of javascript. Something similar to the attached image from
Amazon.com. I'm aiming to make a simple integration with the external sites
to avoid having them do too much on their end.

Is there a best practice on how to handle 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEAUGdWP9-ShhoUKoV3orP6wPAVhihHVxsGR7bYPZQn8T0goBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access data associated to a primary key

2017-10-02 Thread Gourav Chawla
You can create another url, view, template to do that.

Just create a url like : team/id

For the above url create a view, say, teams_under_region which accepts the 
'id'. Based on that id you can then query your database for teams where 
region_member=id. This is just the approach you would follow for functional 
view. But for CBV you have DetailView that takes care of this. Hope this 
helps.

On Monday, October 2, 2017 at 2:53:04 PM UTC+5:30, tangoward15 wrote:
>
> Hi guys, I just want to know how to access and load the data associated to 
> a primary key in a template.
>
> models.py
>
> class Team_Region(models.Model):
> name = models.CharField(max_length=50)
>
> # String representation
> def __str__(self):
> return self.name
>
>
>
> class Team_Name(models.Model):
> t_name = models.CharField(max_length=100)
> logo = models.ImageField(upload_to='team_logos', blank=True)
> region_member = models.ForeignKey(Team_Region, related_name='regions')
>
>
> def __str__(self):
> return self.t_name + ' - ' + str(self.region_member) 
>
>
>
>
> views.py
>
> class TeamRegionListView(ListView):
> context_object_name = 'regions_listview'
> model = Team_Region
> template_name = 'dota_teams/team_regions_list.html'
>
>
> team_regions_list.html
>
> {% block body_block %}
> 
> 
> {% for region in regions_listview %}
> 
> {{ region.name 
> }}
> 
> {% endfor %}
> 
>
> {% endblock %}
>
>
> What I want to achieve is to load the teams' logos and names when the 
> region name link is clicked in the team_regions.html. The teams that will 
> only be displayed in the template are the teams part of the specific ID 
> from Team_Region. Say, region is NA, I want all teams under NA to be 
> displayed in the template.
>
> Not sure how to do this using ListView.
>
> Any suggestions?
>
>
> TIA
>

-- 
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/1b7d75bb-e5ed-4cc5-8b30-7d6487dcb966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Login with different groups

2017-10-02 Thread Gourav Chawla
You can have a look at Django registrations app[1] for inspiration. Also, 
look at the default Django admin login. All of it is there, you just have 
to search a little more and you'll get it.

[1]: https://github.com/macropin/django-registration

On Monday, October 2, 2017 at 4:55:14 PM UTC+5:30, saheb dua wrote:
>
> Hi all,
> I am new to django , i want to make code for login and registration with 
> different groups. example school management student ,teacher and parents 
> should register first and then login in there groups. i want to know basic 
> structure for that. 
>  
>

-- 
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/1b8d5d29-7742-43f2-b135-f3556e5ee67c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help in django application

2017-10-02 Thread harsh sharma
https://docs.djangoproject.com/en/1.11/topics/forms/ you can check this


On Monday, October 2, 2017 at 4:55:14 PM UTC+5:30, djangor wrote:
>
> I m doing a project in django. I've created model classes for each form, 
> master tables and generated db tables from classes. Next for the 
> corresponding classes/tables, 
> I want to create HTML forms with post data handling and after each next 
> button in the forms that I use for submit/ moving to the next related form. 
> Pls help me generate and use the forms.

-- 
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/e10b7a73-920b-4b82-8e90-66d9379e695f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help in django application

2017-10-02 Thread Oladipupo Elegbede
Have you checked any of the tutorials before you started this project?

I know djangogirls.com did a good job on this need. You may want to check
that tutorial, get something done and come back with what you think isn't
right.

This gets help quicker than waiting for someone to help you generate the
forms.

Get your hands dirty and enjoy the learning curve.

Cheers.

On Mon, Oct 2, 2017 at 4:13 AM, djangor  wrote:

> I m doing a project in django. I've created model classes for each form,
> master tables and generated db tables from classes. Next for the
> corresponding classes/tables,
> I want to create HTML forms with post data handling and after each next
> button in the forms that I use for submit/ moving to the next related form.
> Pls help me generate and use the forms.
>
> --
> 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/dfc3f388-c23a-48c0-ab91-96c90444af90%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Elegbede Muhammed Oladipupo

web: www.dipoelegbede.com
skype: dipo.elegbede
mobile: (917) 860 1542

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


Login with different groups

2017-10-02 Thread saheb dua
Hi all,
I am new to django , i want to make code for login and registration with 
different groups. example school management student ,teacher and parents 
should register first and then login in there groups. i want to know basic 
structure for that. 
 

-- 
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/482061ea-d52e-426a-83a4-5acc6d8aba61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


need help in django application

2017-10-02 Thread djangor
I m doing a project in django. I've created model classes for each form, master 
tables and generated db tables from classes. Next for the corresponding 
classes/tables,
I want to create HTML forms with post data handling and after each next button 
in the forms that I use for submit/ moving to the next related form. Pls help 
me generate and use the forms.

-- 
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/dfc3f388-c23a-48c0-ab91-96c90444af90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Access data associated to a primary key

2017-10-02 Thread tango ward
Hi guys, I just want to know how to access and load the data associated to
a primary key in a template.

models.py

class Team_Region(models.Model):
name = models.CharField(max_length=50)

# String representation
def __str__(self):
return self.name



class Team_Name(models.Model):
t_name = models.CharField(max_length=100)
logo = models.ImageField(upload_to='team_logos', blank=True)
region_member = models.ForeignKey(Team_Region, related_name='regions')


def __str__(self):
return self.t_name + ' - ' + str(self.region_member)




views.py

class TeamRegionListView(ListView):
context_object_name = 'regions_listview'
model = Team_Region
template_name = 'dota_teams/team_regions_list.html'


team_regions_list.html

{% block body_block %}


{% for region in regions_listview %}

{{ region.name
}}

{% endfor %}


{% endblock %}


What I want to achieve is to load the teams' logos and names when the
region name link is clicked in the team_regions.html. The teams that will
only be displayed in the template are the teams part of the specific ID
from Team_Region. Say, region is NA, I want all teams under NA to be
displayed in the template.

Not sure how to do this using ListView.

Any suggestions?


TIA

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