These are chat archives for django/django

12th
Jun 2018
Max Kovgan
@mvk
Jun 12 2018 11:17
Hi guys. Is there a standard versioned packaging attitude for Django apps?
Except releasing archives with __version__.pyimplanted somewhere....
Maybe per app
Luke-VideoLibre
@LukeVideo
Jun 12 2018 14:45
@PabloLefort Nothing is printed. I'm looking at the project, someone else wrote it. It seems the setup is a bit convoluted. The form is in a seperate app but is present in the view of the home page.... So not sure why but I didn't manage to make it work the way i expected.
As far as i can tell this is where it is handled
class Home(generic.TemplateView):
    model = Article
    template_name = 'pages/home.html'

    def get_context_data(self, **kwargs):
        form = ContactForm(self.request.POST or None)
        context = super(Home, self).get_context_data(**kwargs)
        context['latest_articles'] = Article.objects.order_by('-date')[:2]
        context['form'] = form
        print("context")
        print(context)
        return context

    #formulaire de contact
    def post(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        if context['form'].is_valid():
            context['form'].save()
            context['form']=ContactForm

        return super(generic.TemplateView, self).render_to_response(context)
But from there i don't understand how i call the form_valid from the contact app...( the one above...)
wmmrunboo
@wmmrunboo
Jun 12 2018 15:00
I want to use Python2 and Django1.11 to do a subject resource - based web site, to upload and download files, and can also carry out the site search in the local implementation, how to do it?
garynobles
@garynobles
Jun 12 2018 15:35
Can anyone help me? Im using django+postgres, i need to connect to various schemas, i have googled and tried tje multischema 'solutions' but i cant get them to work. Inspectdb finds the tables, and I have added the class meta to models.py. Now I'm getting a little desparate since the researchers need one of the modules/apps next week!
garynobles
@garynobles
Jun 12 2018 15:41
@wmmrunboo google is your friend, there are various how-tos out there, I took a course on udemy to get me started, a week was more than enough to get a blog and other things up and running. Once you understand the basics the rest is mostly straight forward. When you get the basics it will be easier to help you develop further.
garynobles
@garynobles
Jun 12 2018 16:20
Here's the models.py
    from django.db import models
    class Storage(models.Model):
        storage_id = models.AutoField(primary_key=True)
        store_name = models.CharField(max_length=200, default='')
        address_1 = models.CharField(max_length=200, default='')
        address_2 = models.CharField(max_length=200, default='')
        region = models.CharField(max_length=200, default='')
        city = models.CharField(max_length=200, default='')
        zip = models.CharField(max_length=200, default='')
        country = models.CharField(max_length=200, default='')
        user = models.CharField(max_length=200, default='')
        datestamp = models.DateTimeField(auto_now=True)

        class Meta():
            managed=False
            db_table='"samples\".\"store"'
and the error: The above exception (column store.storage_id does not exist LINE 1: SELECT "samples"."store"."storage_id", "samples"."store"."st... ^ HINT: Perhaps you meant to reference the column "store.store_id". ) was the direct cause of the following exception:
so it is trying to find schema: samples, table: store, column:storage_id but it is not looking in the right location
garynobles
@garynobles
Jun 12 2018 17:07
The issue cured itself, I had moved from the development db to the production db and as the error told me, I didn't realise there was a column name change! Issue solved.