Python Forum
Issue with Django only some links work?
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with Django only some links work?
#21
I want to see the raw data in the database, rather than on the page, in case something's happening in between.
Reply
#22
how can i show that? i've never used this model of a database before.
Reply
#23
Which database is it?
Reply
#24
django db
Reply
#25
Django isn't a database. I mean, is it SQLite, MySQL, PostgreSQL or something else? What does your database configuration say?
Reply
#26
it gets all the information just fine on the active listings page.

It's just when I try to make each row a clickable link that takes the user to more information about the item, I get that error on some of the entries for some reason.

It's none of those. It's Djangos own internal db system.

query = NewPost.objects.filter(title = title).first()
for some reason, this is not finding a match for all of the entries.

I can see why the lowercase ones wouldn't work. But why don't the ones that are capitalized work?
Reply
#27
(Sep-13-2020, 06:39 AM)card51shor Wrote: it gets all the information just fine on the active listings page.

It's just when I try to make each row a clickable link that takes the user to more information about the item, I get that error on some of the entries for some reason.

OK, that's useful information at least. Can you give examples of links that work and links that don't?

Quote:
query = NewPost.objects.filter(title = title).first()
for some reason, this is not finding a match for all of the entries.

I can see why the lowercase ones wouldn't work. But why don't the ones that are capitalized work?

This is particularly good work! I don't have the data you have so it's difficult to tell. I need to leave now, so don't have too much time to figure out what questions I want to ask next.

---

Putting this later, since I suppose it's not the most important thing right now.

Quote:It's none of those. It's Djangos own internal db system.

What? Django is a web framework that talks to whatever database you have configured. Out of curiosity, I just created a Django project and looking in settings.py, I see that the default database is SQLite 3 - there's a variable called DATABASES that gives me such information. Is that what you have in your settings.py?
Reply
#28
"""
Django settings for commerce project.

Generated by 'django-admin startproject' using Django 3.0.2.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '6ps8j!crjgrxt34cqbqn7x&b3y%(fny8k8nh21+qa)%ws3fh!q'

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

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'auctions',
    '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 = 'commerce.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        '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 = 'commerce.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

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

AUTH_USER_MODEL = 'auctions.User'

# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

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
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'
there's my settings file.

I showed you examples of those that worked and those that don't in the previous posts.
Reply
#29
Yeah, so SQLite is the database you're using. It's quite a small database system - there's no server and the data is just stored in a single file (from line 80, that file is called db.sqlite3 for your app). If you needed to, you could download the command line tools from the SQLite website to interact with the database (e.g. run SQL statements to query the data).

I'm away now for a good few days. Hopefully someone will help you out, else I'll look when I get a chance.
Reply
#30
Nope no one else will help me. Thanks though.

termelonDeliciousfruits ÃTMelons%< !)WatermelonDeliciousfruit`Fruits!; #WatermelonsDelicious_Fruits!: #WatermelonsDelicious[Fruits9 MagicCards"Games@8 #K)Jack rabbitMagee and friends love this palIMagee's TreatsO7 ?E1Fruit basket made of goldSolid gold and full o fruit!Fruits and Friends86 %/1Fruit basketFits lots of ruit µÒFruits and Friends)5 %%Asdfdafdfdasasdfsadfdfda#ÁKChickens4 }}<built-in method capitalize of str object at 0x04DF75C0><built-in method capitalize of str object at 0x04DF6278>ë§Chickens*3 1JacksonFruithoff úFruits and Friends/2 !!1JackingtonFredreciskvFruits and Friends.1 #'!Hlksjlfdldkjlkjlkasjf;ds  ‹ casfadsfdas 0 BagmanFatmasterSbRChickens#/ %BobbyjldtomosdkÒGrasshoppers$. )HellojacksosdajfkdlXGreetings$- )HellojacksosdajfkdlXGreetings, %JackyChan"Martial Arts+ %JackyChan"Martial Arts* %JackyChan"Martial Arts) %JackyChan"Martial Arts( %JackyChan"Martial Arts' %JackyChan"Martial Arts& %JackyChan"Martial Arts% %JackyChan"Martial Arts$ %JackyChan"Martial Arts# %JackyChan"Martial Arts" %JackyChan"Martial Arts! %JackyChan"Martial Arts  %JackyChan"Martial Arts %JackyChan"Martial Arts %JackyChan"Martial Arts- ?PugletA wonderful little puglet@Puglets- ?PugletA wonderful little puglet@Puglets )PugA great animalPugs )PugA great animalPugs )PugA great animalPugs* ;Sandwichpeanut butter and jellyFood* ;Sandwichpeanut butter and jellyFood ChickenLays eggs
Animals '	Bobbyannoys peoplePeople '	Bobbyannoys peoplePeople FredTugginton1Enemies FredTugginton1Enemies Fredjackson2Friends Bobbyjackson2Friends Bobbyjackson2Friends Bobbyjackson2Friends
 '	Bobbyannoys peoplePeople ChickenLays eggs
Animals  Keyboardall keysComputers!
 %MonkeyEats bananas,Animals!	 %MonkeyEats bananas,Animals! %MonkeyEats bananas,Animals! %MouseFast pointerComputers! %MouseFast pointerComputers  Keyboardall keysComputers* #%#PlaystationGreat system ÈVideo Games* #%#PlaystationGreat system ÈVideo Games dfasadsfdasdfds gsdfsdafds
looks like that is the data from the db.sqlite3 file. Hard to read.

I'll move on to other parts of the project and come back to this when someone can help me. Thanks
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020