Вячеслав
If you need to migrate to other db you need the migrate command
Вячеслав
"python manage.py migrate"
Akash
Ok
Akash
Thank you
Rahul
Can any one help me to create mws token for Amazon seller api
Michael ✨
.
Zerat
How can i implement "related products" or "simmilar books " for my django bookstore
Charly
have you tried it?
Shubham
There is no model given to filter kn
Shubham
You are filter on parent status, that's correct right?
Peppe
https://stackoverflow.com/questions/67286037/why-the-platform-create-a-new-wallet
Anyone?
Zoro
yes. sure. if order is a foreign key, with order__ you can access the order fields for each product row.
Zoro
Peppe
Thanks!
Peppe
okok
Peppe
@login_required
def wallet_new(request):
wallets = Wallet.objects.all()
if request.method == "POST":
form = WalletForm(request.POST)
if form.is_valid():
new_wallet = form.save(commit=False)
new_wallet.profile = request.user
new_wallet.save()
return render(request, 'app/response_wallet_executed.html')
form = WalletForm()
contex = {'form': form}
return render(request, 'app/wallet_new.html', contex)
Zoro
Peppe
ok
Zoro
good luck😁
Peppe
Thanks!
Peppe
wait, i don't understand
Peppe
@login_required
def wallet_new(request):
wallets = Wallet.objects.filter(profile=request.user)
if request.method == "POST":
form = WalletForm(request.POST)
if form.is_valid():
new_wallet = form.save(commit=False)
new_wallet.profile = request.user
new_wallet.save()
return render(request, 'app/response_wallet_executed.html')
form = WalletForm()
contex = {'form': form}
return render(request, 'app/wallet_new.html', contex)
Peppe
right?
Peppe
i want to check if the user has a wallet, if user not has a wallet,it create, but if the user has a wallet, return page: 'you have a wallet'
Peppe
and if i use the variable 'wallets' and compare with new_wallet,profile return an error, i can't compare new_wallet.profile with 'nonetype', because the user has not a wallet, don't exists
Zey
Hii,I am sending email template using send_mail but when I am receiving mail it is not showing images which are in template?
Zerat
Zerat
Zoro
Zerat
aha. yes. that makes sense
class Book(models.Model):
authors = models.ManyToManyField('Author', help_text="Add authors that contributed the this book.", related_name="authors")
isbn = models.CharField('ISBN 13', max_length=13, unique=True, help_text='13 Character <a href="https://www.isbn-international.org/content/what-isbn">ISBN number</a>')
...
genre = models.ManyToManyField(Genre, help_text='Select a genre for this book')
...
Zerat
Zoro
Zerat
Zerat
Elii
Hi guys.
How can I serialize when I have multi models that have relationships?
For exp: I have these tables that related each other with FK
Account -> Product ->Attribute->Attribute value
Elii
Zerat
and then, you need to make serializer for each model, like
class GenreSerializer(serializers.ModelSerializer):
class Meta:
model = Genre
fields = ('name',)
class LanguageSerializer(serializers.ModelSerializer):
...
class AuthorSerializer(serializers.ModelSerializer):
...
Rup
i deleted all database and freshly start to create database table. i deleted all migrations from all app. and make new migrations now i am getting this error at the time of migrationg
Rup
error: psycopg2.errors.UndefinedTable: relation "sales_creditnote" does not exist.
Rup
i used "sales_creditnote" as foreignkey
Rup
please help me i am struglling from morning still unable to solve.
noneofurfuckinbusiness
noneofurfuckinbusiness
Into database
noneofurfuckinbusiness
Delete ur database, create a new one, then makemigrations, then migrate
Rup
Yes, but when I am applying python manage.py makemigrations It shows no migrations to apply and python manage.py migrate it shows error
noneofurfuckinbusiness
Y don't need to delete migration files, if u delete database
noneofurfuckinbusiness
noneofurfuckinbusiness
Delete migrations of all apps
Rup
I deleted all migrations from all app and database also
noneofurfuckinbusiness
Hmm. Do u have git repository of ur project
Rup
No
noneofurfuckinbusiness
Send me clone url, will check ur code
noneofurfuckinbusiness
Upload to git.
Rup
I don't have git yet
noneofurfuckinbusiness
Is it showing no migrations to apply even after deleting all migrations?
Rup
Yes
Rup
No changes detected
noneofurfuckinbusiness
How did u delete database?
Sumit
Hi, I have very strange error , I am using nginx with django, when I am using debug =True , it is working fine, but when I am using debug =False, it is throwing Server Error(500).Please help me.
Rup
In postgres I drop the database and create new one
noneofurfuckinbusiness
If u deleted all migrations, then it should not show no changes detected
Rup
Yes but it's showing. Where I am doing wrong. Not getting it
noneofurfuckinbusiness
How did u delete migrations
Rup
In vs code select folder migrations right click delete
noneofurfuckinbusiness
Ok, go to sales app folder, open migrations folder
noneofurfuckinbusiness
Remove pycache too
noneofurfuckinbusiness
Rup
Okay
noneofurfuckinbusiness
Sumit
Sumit
I am just refreshing
noneofurfuckinbusiness
yes
Write a try except statement for every line in view of that url with some message in print(), find out which line is causing error
Rup
I deleted pycashe too. And run makemigrations. It says no changes detected
Rup
Pycache