Saturday, June 30, 2018

Re: Django production deployment on my VPS

hi Kamal,
I found this link as part of a django training I did in a udemy course (https://www.udemy.com/the-ultimate-beginners-guide-to-django-python-web-dev-website).

Link is:

I hopes that helps you.
Gerardo.



El 30/06/2018, a la(s) 21:22, Kamal Sharma <kamal.kld11@gmail.com> escribió:

Dear Django community,

I have developed my django application but i am facing problem to deploy it on my "virtual private server". And tutorial of production deployment are making me so confuse so i am unable to deploy it.
Can you please share with me the steps to deploy my django project on production with VPS.

Your immediate action will be highly appreciated.

Thanks

Kamal Sharma

--
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+unsubscribe@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/095a451f-4b0a-49e6-8d2a-baa3f53832c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django production deployment on my VPS

Dear Django community,

I have developed my django application but i am facing problem to deploy it on my "virtual private server". And tutorial of production deployment are making me so confuse so i am unable to deploy it.
Can you please share with me the steps to deploy my django project on production with VPS.

Your immediate action will be highly appreciated.

Thanks

Kamal Sharma

--
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+unsubscribe@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/095a451f-4b0a-49e6-8d2a-baa3f53832c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Database

I've used both. If you have a choice use Postgres.

Mike

Connected by Motorola


ABHISHEK PARMAR <150305105052@paruluniversity.ac.in> wrote:

Should i use postgres or mysql ?

--
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+unsubscribe@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/CAErr1ZUERxGq26gkkhmPG_1iOdKwvMpHCoZdu2uJEhVhjNLXUQ%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+unsubscribe@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/e060brfnkg2hen7383muowx6.1530400605221%40email.android.com.
For more options, visit https://groups.google.com/d/optout.

Re: Database

Use whichever one you are more familiar with, unless there is a technical reason for your specific project to pick one over the other. Familiarity is important if you are just learning django, as you don't need too many learning curves at the same time. Sometimes, it is helpful to look at the tables that django creates to debug a problem. Knowing how to quickly access the db can be important. Or, sometimes injecting data into the db can help with debugging. At the end of the day, they are just tools, so use the one that you like the most. Personally, I prefer a left handed spanner the most....

Mark

On Sat, Jun 30, 2018 at 1:21 PM, Joshua Kayode <joshuakayode169@gmail.com> wrote:
Use postgresql,  but you can find reasons not to!,  the choice between MySQL and postgresql is more or less personal! Both have their strengths and weakness! 

On Jun 30, 2018 14:05, "ABHISHEK PARMAR" <150305105052@paruluniversity.ac.in> wrote:
Should i use postgres or mysql ?

--
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+unsubscribe@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/CAErr1ZUERxGq26gkkhmPG_1iOdKwvMpHCoZdu2uJEhVhjNLXUQ%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+unsubscribe@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/CAEL9fCFf4MrrW3mPjXzUqYrwPxjbe29boD6QHPZFALXm3F_gsw%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+unsubscribe@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/CAEqej2O%3DzFjqmpciDCu7ZvHTrsv6rZEVAQthDYQO0dRDdsjGDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Database

Use postgresql,  but you can find reasons not to!,  the choice between MySQL and postgresql is more or less personal! Both have their strengths and weakness! 

On Jun 30, 2018 14:05, "ABHISHEK PARMAR" <150305105052@paruluniversity.ac.in> wrote:
Should i use postgres or mysql ?

--
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+unsubscribe@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/CAErr1ZUERxGq26gkkhmPG_1iOdKwvMpHCoZdu2uJEhVhjNLXUQ%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+unsubscribe@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/CAEL9fCFf4MrrW3mPjXzUqYrwPxjbe29boD6QHPZFALXm3F_gsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Cannot add choice filed with radio buttons in my model form using widget but only charfield.

post-form.html
{% extends "posts/post_base.html" %}

{% load bootstrap3 %}

{% block post_content %}
<h4>{% if not form.instance.pk %}
Create Post
{% else %}
Update Post
{% endif %}</h4>
<form method="POST" id="postForm">
{% csrf_token %}
{% bootstrap_form form %}
<input type="submit" value="Post" class="btn btn-primary btn-large">
</form>
{% endblock %}


models.py
from django.conf import settings
from django.urls import reverse
from django.db import models

import misaka

from django.contrib.auth import get_user_model
User = get_user_model()

class Teacher(models.Model):
    teacher_name = models.CharField(blank=False, max_length=100, unique=True, null=False)

    def __str__(self):
        return self.teacher_name

class Subject(models.Model):
    subject_name = models.CharField(blank=False, max_length=100, unique=True, null=False)

    def __str__(self):
        return self.subject_name

class Post(models.Model):

    user = models.ForeignKey(User, related_name="posts", on_delete=models.CASCADE)
    teacher = models.ForeignKey(Teacher, related_name="posts", on_delete=models.CASCADE, null = False, blank = False)
    subject = models.ForeignKey(Subject, related_name="posts", on_delete=models.CASCADE, null = False, blank = False)
    created_at = models.DateTimeField(auto_now=True)
    param1 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "The objectives of this course were made clear to me by this teacher.")
    param2 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "The teacher speaks, articulates and explains concepts clearly.")
    param3 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "The teacher adheres to the timings schedule and enforces discipline in the class.")
    param4 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "Interest generated by the teacher.")
    param5 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "The lectures were well structured and focused on the topics.")
    param6 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "Accessibility of the teacher in and out of the class.")
    param7 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "The teacher has fair knowledge on the subject matter.")
    param8 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "Effective use of teaching aids.")
    param9 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "Time spend on lecturing by teacher for course coverage was sufficient and lesson plan was followed.")
    param10 = models.PositiveIntegerField(blank=False, null=False, verbose_name = "The teacher encourage students to raise pertinent questions and answer them.")
    average = models.FloatField()
    message = models.CharField(blank=False, max_length=100, null=True, verbose_name = "Anything else you want to say.")

    def __str__(self):
        return self.teacher.teacher_name

    def get_absolute_url(self):
        return reverse(
            "posts:single",
            kwargs={
                "username": self.user.username,
                "pk": self.pk
            }
        )

    def save(self, *args, **kwargs):
        self.average = (self.param1 + self.param2 + self.param3 + self.param4 + self.param5 + self.param6 + self.param7 +self. param8 + self.param9 + self.param10)/10
        super().save(*args, **kwargs)

    class Meta:
        ordering = ["-created_at"]
        unique_together = ["user", "teacher", "subject"]


forms.py
from django import forms

from posts import models


class PostForm(forms.ModelForm):

    class Meta:
        model = models.Post
        fields = ("teacher","subject","param1","param2","param3","param4",
                    "param5","param6","param7","param8","param9","param10","message")
        choices = (
                    (1,'Unsatisfactory'),
                    (2,'Satisfactory'),
                    (3,'Good'),
                    (4,'Very Good'),
                    (5,'Outstanding')
                    )
        widgets = {
                'param1':forms.TypedChoiceField(choices=choices, widget=forms.RadioSelect, coerce=int),
                'message': forms.Textarea(attrs={'cols': 80, 'rows': 20}),
        }

--
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+unsubscribe@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/CAMO5YApwyjBSZgFEKHc6F0c1NVJCwdPkpnr%3DY%2B%3DV00hZsPSCcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: django windows apache tell if apache is working

I meant the tutorial at https://docs.djangoproject.com/en/2.0/intro/tutorial01/

That said, there's a few different ways you can actually deploy, but digitalocean has some good resources for starting out.


This one shows how to use apache on ubuntu, and you should be able to extrapolate to use wamp.

what I would do is just set up a simple view to return a http response saying "working", and map that to the root.  Something like 

app/views

def index(request):
    return HttpResponse("Working!")

app/urls

from app.views import index
urlpatterns = [
    path('', index), 
]

and hit localhost.  That'll be all you need.

Hi,
Thanks.
Yes, I went thru the Mozilla library tutorial on a fedora dev machine to the point where I realized I needed to do more with the last mile, so to speak working on setup of the production server part on Windows and wamp.
Seems most tuts end at manage.py runserver, or start into deployment from dev to production.  I can't seem to locate a good uptodate tut for wamp that shows how to test everything is working properly in a simple manner for the wsgi part.

I'm just trying to verify the plumbing (httpd.conf, settings.py wsgi.py) is working with apache, before spending too much more time building a site.  

On Sat, Jun 30, 2018 at 2:54 AM, Jason <jjohn...@gmail.com> wrote:
appreciate the detailed report :-)

so, have you set up the django tutorial project?  that application method in wsgi doesn't make any sense.  you should have urls and views set up in your project

--
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/-eJaLuJ85KE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@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/6d241c04-55be-4524-959e-09630a7bc21f%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+unsubscribe@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/6f5e5996-a85e-4eb6-b5e4-804f7379a2b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: django windows apache tell if apache is working

Hi,
Thanks.
Yes, I went thru the Mozilla library tutorial on a fedora dev machine to the point where I realized I needed to do more with the last mile, so to speak working on setup of the production server part on Windows and wamp.
Seems most tuts end at manage.py runserver, or start into deployment from dev to production.  I can't seem to locate a good uptodate tut for wamp that shows how to test everything is working properly in a simple manner for the wsgi part.

I'm just trying to verify the plumbing (httpd.conf, settings.py wsgi.py) is working with apache, before spending too much more time building a site.  

On Sat, Jun 30, 2018 at 2:54 AM, Jason <jjohns98684@gmail.com> wrote:
appreciate the detailed report :-)

so, have you set up the django tutorial project?  that application method in wsgi doesn't make any sense.  you should have urls and views set up in your project

--
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/-eJaLuJ85KE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@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/6d241c04-55be-4524-959e-09630a7bc21f%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+unsubscribe@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/CALWZDaPoCygU8hSSYcsEpQnHGE%2B52EUxAyOko3kPRhR12t6HCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Queryset calculation and then filter/exclude/limit data rendered

I figured it out.  Probably not the ideal solution, but it works for now.

I did not realize you could use an IF tag in the the template.  I then passed the fromDate and toDate into the template and used that to limit the records to only that particular month.

Hopefully as my skills increase I will find more elegant solutions.

rod

On Friday, June 29, 2018 at 3:02:58 PM UTC-5, rod termaat wrote:
I totally get what you are saying and thanks.  I tried a similar strategy.  I do qs = Check.objects.all()  and then I have to do the calculation as there is no balance in the model so I generate it on the fly in the for loop.  My hope was to then filter qs like you show.  It works, but my balance calculation is lost which is integral to the process.

my filter code looks like:
monthdata = check_list.filter(dater__gte=CalendarFromMonth, dater__lte=CalendarToMonth)

After some research that seemed like expected behavior where filter goes back thru the OCR where as I was hoping it would just filter on check_list and therefore retain the balance amount.

Thanks for your perspective, rod


On Friday, June 29, 2018 at 3:13:46 AM UTC-5, Derek wrote:
Its not completely clear what you are doing.

You need to avoid logic in your template; but you say "excluding data from the the queryset in the for loop which is easy in other languages, but this also seemed to be a no go".  That is not the case if your logic is written in the correct way.

In my case I need to present a month-by-month view of orders; the UI displays day-by-day entries for the selected month (defaults to current month) with two "buttons" (hyperlinks) that are set to a +1 and -1 delta relative to the current month number so the user can jump back and forth easily.  The function in the views.py file accepts the month number as an argument and filters orders based on that month e.g. in your case you might do:

qs = Check.objects.all()
if selected_month:      qs = qs.filter(created__month=int(selected_month))
where selected_month would be a argument passed into your view.  You can then apply other calculation logic on the list.  


On Thursday, 28 June 2018 02:09:21 UTC+2, rod termaat wrote:

I have a small checkbook application where I store transactions (expenses and income) amounts by date.  I render these to a template using python to add the cumulative balance prior to render.  This work fine for my little application, but not too sure how scalable it will be over time.


My goal is to have this displayed by month with the running balance.  I first researched custom pagination, but found nothing on date pagination by month and year.  I then started down the road of excluding data from the the queryset in the for loop which is easy in other languages, but this also seemed to be a no go.  My current thought is to exclude the data from the queryset in the for loop and move the data into a dictionary or list, or json.


Any advice for me?  Right now I need all objects from the Check model to get an accurate balance and then I need to filter that to limit the records by month.


Finally, I did tried to filter the check_list after the balance was added, but found out that does not work as the query goes back to the model and I loose the balance.


Here is my model


class Check(models.Model):

    """

    Model representing a checkbook transaction.

    """

    check_type = (('CR', 'credit'),('DR', 'debit'),('SV', 'savings'),('DT', 'debt reduction'),)

    

    dater = models.DateField(help_text=' .the date of the transaction')

    type = models.CharField(max_length=2, choices=check_type, help_text=' .credit or debit')

    category = models.ForeignKey('Category', on_delete=models.SET_NULL, null=True)

    name = models.CharField(max_length=100, help_text=' .description')

    amount = models.IntegerField(default=0, help_text=' .amount')

    cleared = models.BooleanField(help_text=' .cleared with the bank?')

    created = models.DateTimeField(auto_now_add=True)


Here is my function view


def checkbookList(request):

    check_list = Check.objects.all()

    #checks = Check.objects.all()

   

    balance = 0

    #for chk in checks:

    for chk in check_list:

        balance += chk.amount

        chk.balance = balance


        if chk.cleared:

            chk.cleared = '\u221A'

        else:

            chk.cleared = '-'


    return render(request, 'checkbook/checkbook.html', {'checks': check_list})


--
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+unsubscribe@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/25ff02ac-5b44-4cde-94e7-142167214285%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: django windows apache tell if apache is working

appreciate the detailed report :-)

so, have you set up the django tutorial project?  that application method in wsgi doesn't make any sense.  you should have urls and views set up in your project

--
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+unsubscribe@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/6d241c04-55be-4524-959e-09630a7bc21f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Can't access my django runserver

you're missing a comma at the end of 

 'DIRS': [os.path.join(BASE_DIR, 'templates')]

for future reference, if you want people to help you, give the information up front as well as context.  Your original posting showed minimal information, so there was nothing we could do until you posted the above.

You should also be using a text editor like atom, sublime, vscode, etc with a graphical linter so you can see syntax errors like the above more easily.

--
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+unsubscribe@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/65a0ae6d-c957-4b65-b8f9-8c8ccffd58ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Can't access my django runserver

I think there is a ' , ' missing after 'DIRS' in Templates settings

On Saturday, 30 June 2018, Umar Kambala <umarkambala@gmail.com> wrote:

this are my codes...

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
ALLOWED_HOSTS = ['localhost', '.pythonanywhere.com']


# Application definition

INSTALLED_APPS = [
    'polls.apps.PollsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

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 = 'mysite.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'mysite.wsgi.application'


# Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'GMT'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'STATIC')
MASSAGE_STORAGE = 'django.contrib.message.storage.session.SessionStorage'


this what i get when i run python manage.py runserver
line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 317, in execute
    settings.INSTALLED_APPS
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__
    self._setup(name)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Admin\Desktop\Djan Polls\mysite\mysite\settings.py", line 60
    'APP_DIRS': True,
             ^
SyntaxError: invalid syntax

On Fri, Jun 29, 2018 at 6:00 AM, Mikhailo Keda <mriynuk@gmail.com> wrote:
show your 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+unsubscribe@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/3d5e9f26-3170-440f-b06b-9b9f7ef976d0%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+unsubscribe@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/CAPkbFbZSz-KFDZ1HdKCAgXCTb-noVmLWPUM-p2ijZxuK0Kjwow%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+unsubscribe@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/CAHfehoXe-9Z5M92EbFmp8TtoGim4Tdd%2BObnXHbiFnd6GeF2B7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Can't access my django runserver

You forgot to put 'comma' after DIRS': [os.path.join(BASE_DIR, 'templates')] in templates.

It should be DIRS': [os.path.join(BASE_DIR, 'templates')], 

On Sat 30 Jun, 2018, 15:52 Umar Kambala, <umarkambala@gmail.com> wrote:

this are my codes...

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
ALLOWED_HOSTS = ['localhost', '.pythonanywhere.com']


# Application definition

INSTALLED_APPS = [
    'polls.apps.PollsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

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 = 'mysite.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'mysite.wsgi.application'


# Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'GMT'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'STATIC')
MASSAGE_STORAGE = 'django.contrib.message.storage.session.SessionStorage'


this what i get when i run python manage.py runserver
line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 317, in execute
    settings.INSTALLED_APPS
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__
    self._setup(name)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Admin\Desktop\Djan Polls\mysite\mysite\settings.py", line 60
    'APP_DIRS': True,
             ^
SyntaxError: invalid syntax

On Fri, Jun 29, 2018 at 6:00 AM, Mikhailo Keda <mriynuk@gmail.com> wrote:
show your 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+unsubscribe@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/3d5e9f26-3170-440f-b06b-9b9f7ef976d0%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+unsubscribe@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/CAPkbFbZSz-KFDZ1HdKCAgXCTb-noVmLWPUM-p2ijZxuK0Kjwow%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+unsubscribe@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/CAC3mK7dC44w-vAvPruFcKJ4yQsk%2BROzNHmiFFWb%2Bzq4PqQOLdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Can't access my django runserver


this are my codes...

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
ALLOWED_HOSTS = ['localhost', '.pythonanywhere.com']


# Application definition

INSTALLED_APPS = [
    'polls.apps.PollsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

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 = 'mysite.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'mysite.wsgi.application'


# Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'GMT'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'STATIC')
MASSAGE_STORAGE = 'django.contrib.message.storage.session.SessionStorage'


this what i get when i run python manage.py runserver
line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 317, in execute
    settings.INSTALLED_APPS
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__
    self._setup(name)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Admin\Desktop\Djan Polls\mysite\mysite\settings.py", line 60
    'APP_DIRS': True,
             ^
SyntaxError: invalid syntax

On Fri, Jun 29, 2018 at 6:00 AM, Mikhailo Keda <mriynuk@gmail.com> wrote:
show your 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+unsubscribe@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/3d5e9f26-3170-440f-b06b-9b9f7ef976d0%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+unsubscribe@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/CAPkbFbZSz-KFDZ1HdKCAgXCTb-noVmLWPUM-p2ijZxuK0Kjwow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Friday, June 29, 2018

Database

Should i use postgres or mysql ?

--
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+unsubscribe@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/CAErr1ZUERxGq26gkkhmPG_1iOdKwvMpHCoZdu2uJEhVhjNLXUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

django windows apache tell if apache is working


Hi,

I'm new to this group, and also new to Python, and Django.  Seems like lots of good info for django on this group.

Sorry for long, detailed descriptions, below, but I am stuck trying to verify wamp, apache and django are working as a production server on a Windows 7, 32-bit machine.

I am hung on last mile part (way below), or how to see something in the browser using apache, not the dev runserver.  The dev server seems to work fine at this point showing default django startup page.

I'm not sure how to proceed with verifying apache is working as a production server.  If all is working, should apache show the same Python default start page as the dev server?  Or what simple web pages should I implement to verify the apache connection is actually working on the server?

Wamp is also working fine with it's own www directory and local webpages etc. using apache.


Wampserver 3.0.6 32bit, with apache2.4.23
---------------
PYTHON AND APACHE:

Python 3.6.5 32bit, with Django 2.0.6

Tried following Eastwood description for Django setup for Wamp
https://ericeastwood.com/blog/3/django-setup-for-wamp
---------------
MOD_WSGI:

Could not pip install mod_wsgi, and needed to download VisualStudio build tools and upgrade framework to 4.7.1.

Downloaded mod_wsgi-4.5.24+ap24vc14-cp36-cp36m-win32.whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/
to work with apache 2.4.23, VC++14, and python3.6

then did >> pip install C:\Users\Administrator\Downloads\mod_wsgi-4.5.24+ap24vc14-cp36-cp36m-win32.whl.  Did not get mod_wsgi.so in apache modules folder, but did get a .pyd in: c:/users/administrator/appdata/local/programs/python/python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd

Could then run mod_wsgi-express.

From cmd prompt in apache bin dir used >httpd -t -D DUMP_MODULES to show wsgi_module (shared) is present.
---------------
VIRTUALENV:

Per Eastwood description (above), inside c:/wamp created a new directory www-src next to www which is where our other wamp sites are located. Inside c:\wamp\www-src ran >virtualenv django_project, then django_project\Scripts\activate.  See (django_project) as prefix to cmd prompt. With virtual environment active did >pip install django.  Then (django_project_ c:\wamp\www-src > django-admin.py startproject django_project .  to setup up project in current or www-src directory.

c:\wamp\www-src\django_project
c:\wamp\www-src\static
c:\wamp\www-src\db.sqlite3
c:\wamp\www-src\manage.py

and in c:\wamp\www-src\django_project have settings.py, urls.py, and wsgi.py, etc.
---------------
SETTINGS.PY

in settings.py change STATIC_URL to:

STATIC_ROOT = 'C:/wamp/www-src/static'
STATIC_URL = 'http://XXXmyipXXX/static/'


also added localhost, and my local IP to ALLOWED_HOSTS in settings.py
---------------
MIGRATIONS:

then from c:\wamp\www-src run
(django_project) c:\wamp\www-src >manage.py makemigrations
then
(django_project) c:\wamp\www-src >manage.py migrate

also ran >(django_project) c:\wamp\www-src >manage.py collectstatic
although static dir is empty at this point.
---------------
DEVELOPMENT SERVER:

(django_project) c:\wamp\www-src >manage.py runserver 0.0.0.0:8000

From the browser > http://localhost:8000 this initially caused windows firewall error to appear but an exception was added to allow it to continue.

Can see python default page, and also localhost:8000\admin too on Dev server.  Dev server can be seen by other machines on the network too.
----------------
CONFIGURE APACHE:
for production server using wamp instead of dev server.

using mod_wsgi-express settings in httpd.conf.
Apache httpd.conf is in:
C:\wamp\bin\apache\apache2.4.23\conf\httpd.conf

Apache httpd-vhosts.conf is in:
C:\wamp\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf

added to httpd.conf:
LoadFile "c:/users/administrator/appdata/local/programs/python/python36-32/python36.dll"
LoadModule wsgi_module "c:/users/administrator/appdata/local/programs/python/python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"

WSGIPythonHome "c:/users/administrator/appdata/local/programs/python/python36-32"
WSGIScriptAlias /django-project "C:/wamp/www-src/django_project/wsgi.py:C:/wamp/www-src/django_project/wsgi_app.py"
WSGIPythonPath "C:/wamp/www-src/django_project/:C:/wamp/www-src/django_project/Lib/site-packages"

<Directory "C:/wamp/www-src/django_project/">
    <Files wsgi.py>
        Order deny,allow
        Require all granted
    </Files>
    <Files wsgi_app.py>
        Order deny,allow
        Require all granted
    </Files>
</Directory>


added to httpd-vhosts.conf:
<VirtualHost *:80>
Alias /static c:/wamp/www-src/static
<Directory c:/wamp/www-src/static>
        Require all granted
    </Directory>
</VirtualHost>

...restarted apache
----------------------------

CONFUSED FROM HERE...or last mile to verify production server can run django from virtual environment.

If try localhost:8000 in browser see ERR_CONNECTION_REFUSED.
If try localhost/wsgi and have wsgi_app.py in django_project, see requested URL not found.

wsgi_app.py

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World from django_project!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

--
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+unsubscribe@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/99fc6ee8-b5b3-4da0-b11d-e5d34eff6076%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: django.contrib.admin


On Fri, Jun 29, 2018 at 4:43 PM Jim Lamb <jlamb85@gmail.com> wrote:
How can I override the list_display to add fields in my admin console for users?

--
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+unsubscribe@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/e7613363-d11a-43cb-9849-7af5ef864f04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
att.
Carlos Rocha

--
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+unsubscribe@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/CAM-7rO1uMikc86%3DRq17QPCtvROyofe8dOfD5NCPH4H%2BfYDSOiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Admin

Teja,

First, let me suggest you just copy and paste your models from models.py. People who use Django a lot may find it easier to read the code (because they are familiar with the syntax and layout) than your typed summary of the classes.

Second, Django by itself cannot do what you want it to do. Django just makes html pages from the models, views, and templates you define, or are found in the admin classes. Once a page is displayed, that is what you get until the page is re-loaded from the server. What you are trying to do is have the page change without a round trip to the server. For that, you need some form of Javascript talking to the server as well. You can change the contents of an html page based on a selection in a select box using some Javascript to detect the change in the page and then talks to a Django view; the view in Django gets the data you want from the database and returns that data to the script, which updates the html page; and an appropriate url for the script to talk to the view and for the view to listen to. That is just one way to accomplish what you want to do. There are also add-on django projectst that will do this for you. Google for django smart selects, django autocomplete, django ajax, and this page of projects - https://djangopackages.org/grids/g/auto-complete/.

Good luck!

Mark

On Fri, Jun 29, 2018 at 7:27 AM, Teja Yerraballe <teja.yerraballe@aspiresys.com> wrote:

Hi Team,


I have created 4 models ( class Company, class Department, class Section, class Employee )


Company Model has : CMP1, CMP2, CMP3, CMP4, CMP5(Year is the foreign key in this model)


Department Model has : DEP1, DEP2,DEP3,DEP4,DEP5 (Company is the foreign key in this model)


Section Model has : SEC1, SEC2,SEC3,SEC4,SEC5 (Department is the foreign key in this model)


Employee Model has : EMP1,EMP2,EMP3,EMP4,EMP5 (Section is the foreign key in this model)



Now I have created 2 more models (class Details, Class Map)


Details Model Fields:


salary


Map Model Fields


Company ( foreign key Company Model)

Department (foreign key Department Model )

Section (foreign key section Model)

Employee (foreign key employee Model)


Details Model will Map salary for the employees


I need to show these two models in admin page ( class Map as the inline model for class Details)


=================================================================================

ADMIN PAGE looks as below :


Details 


select salary range

 (drop down)


MAP [ inline Model ] : Need to Map employees who come under the salary range


  1.  select Company      select Department        select Section       select Employee

           (drop down)              (drop down)                   (drop down)           (drop down)

     2. select Company      select Department        select Section       select Employee

           (drop down)              (drop down)                   (drop down)           (drop down)

     3select Company      select Department        select Section       select Employee

           (drop down)              (drop down)                   (drop down)           (drop down)


======================================================================================


=> On selecting a company, we should display only departments in that company.

=> On selecting Department, we should display only sections in that Department.

=> On selecting Section, we should display only employees in that Section.

 


I am messed with this implementation, Please help me out in this. If possible please brief me the steps to follow on this implementation


Thanks in Advance


Regards,


Teja Y

LAMP





Aspire Systems

This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

--
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+unsubscribe@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/SG2PR02MB3532FF8BEF86B8796A035268FF4E0%40SG2PR02MB3532.apcprd02.prod.outlook.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+unsubscribe@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/CAEqej2MedgiOTf6uExRKEVzyLNcMU1q_xjCWAw79sr-bDyZo9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.