How to show subcategory image in opencart - opencart

I have added the extension but getting an error of model not found
Notice: Error: Could not load model D:\xampp\htdocs\youthiapa/admin/model/extension/module.php! in D:\xampp\htdocs\youthiapa\system\modification\system\engine\loader.php on line 24

Related

'NoneType' object has no attribute 'subscription_type'

I am currently learning Django and try to implement payment method watching youtube. so for payement i use Stripe. the payement was sucessful. however i face the following error when i try to link the profile model. but i get the error enter image description here
the view.py was
enter image description here
the model was:
enter image description here

How to save Image using CharField max_length=1024 i.e longext in django

I am working on a project where we want the profile pic of user to be in a CharField i.e longtext. Now, in ModelForm for updating the user's profile I want to get profile pic and want to resize and compress it and save it in database with unique name like using timestamp.
The problem that I have is that I can get image name using cleaned_data from form but cannot process it for resize or compression and it gives me the error of no file or directory is found

Deal with django ImageField current value displayed in forms

I'm trying to remove the clear checkbox in Django's ImageField and remove the displayed current value of the file. Tha approach I tried is to replace the widget as proposed here How to not render django image field currently and clear stuff? but the result is that I get ValidationError :
"Upload a valid image. The file you uploaded was either not an image or a corrupted image.". Though the validation error the image get's uploaded, but I do not get redirected to the success page and an error is being rendered in the form.
What's the recommended way to remove the current value in the ImageField?
A solution that works for me, though I'm not sure how good is it.
profile_picture = forms.FileField(label='Upload profile picture', widget=forms.FileInput,validators=[validators.validate_image_file_extension], required=False)
I replaced ImageField with FileField and then added the ImageField default validator with FileInput widget and then added 'accept': 'image/*' to that widget, so the select shows only images. In this way I mimic the ImageField, but no error occurs.

Form field validation - who renders the error?

I have a model which contains 2 fields of type PositiveSmallIntegerField.
And I have a ModelForm for this model and these fields.
My validation works fine. But if I type in negative number or alphanumeric string, I get the validation error as some sort of pop-up(see images below). My question: is the validation error rendered by the browser? Shouldn't the error be rendered by Django as HTML code?
And can I translate this error with django translations?
Also, in my clean method of the form I have a custom validation and I do this:
if cleaned_data['capacity_min'] > cleaned_data['capacity_max']:
raise ValidationError(_("Some message"))
I can translate this one and it is rendered as I was expected, simple HTML code in the page
Thank you
This is what happens with firefox
This is what happens with Google Chrome
These hint errors are showed by browser. Browser rejects to submit the invalid form to the server so your django validation didn't even run.
To solve this problem change the widget for you field from NumberInput to TextInput:
class MyForm(forms.ModelForm):
class Meta:
...
widgets = {
'capacity_min': forms.TextInput(),
'capacity_max': forms.TextInput(),
}

using uuid as id/pk in django breaks admin page

i am using django 1.0.4 and have 3 models: Category <-1-m-> Item <-1-m-> Image.
i recently changed the id/pk to uuid:
id = models.CharField(max_length=32, primary_key=True,
default=make_uuid, editable=False)
...
def make_uuid():
return str(uuid.uuid4()).replace('-','')
after i started using uuid, the Item's admin page would no longer let me inline add an Image. it would give me a form validation error even though there isn't any error. furthemore, if an Item has an Image, i can't change the Category, it would give me the following error:
KeyError at /admin/inventory/item/90965921681b4b69880b36bd716b0831/
id
...
/local/env/bfi2/lib/python2.6/site-packages/Django-1.0.4-py2.6.egg/django/forms/forms.py in _raw_value
213. field = self.fields[fieldname]
i think this is similar to the following bug: http://code.djangoproject.com/ticket/10992. ideally, i would like to avoid upgrading django and just patch the necessary files. has anyone else ran into this problem?
thanks,
steve
I've gone into such problems but they got solved with django-extensions UUID field.
But I cannot guarantee that this Field will work with an old django version, it was on 1.2.3